Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Message ID: 3263     Entry time: 17 Aug 2026
Author: Konstantin Olchanski 
Topic: Info 
Subject: change in cm_shutdown and the Programs page 
There was a bit of confusion on the MIDAS Programs page with programs that have 
similar names. This confusion relates to the use of bUnique in cm_shutdown() and 
cm_exist().

bUnique is now removed from cm_shutdown(), midas client name passed to this call 
must match the client name exactly (as reported i.e. by odbedit "scl"). this is 
same as calling cm_shutdown() with bUnique set to TRUE.

bUnique remains in cm_exist() for now. everybody calls it with bUnique set to 
TRUE, except for the "program not running" alarm and for the "start program" 
code on the MIDAS Programs page. After they are updated, bUnique will be removed 
from cm_exist() as well. it will require the exact client name, same as calling 
it with bUnique set to TRUE.

the related confusion on the MIDAS Programs page was caused by the code for 
matching client entries in /System/Clients to program pages in /Programs. This 
is needed to report Alarm conditions, "start" and "stop" buttons, etc.

the MIDAS Programs page is constructed from ODB /Programs, each program entry 
gets one line on the web page. (non-running, non-required programs are omitted).

normally, there is only 1 copy of each MIDAS program running (i.e. mhttpd, 
mlogger, mserver, vme frontend, etc) and the client name is the same as the 
program name in /Programs, matching them is easy and they are always shown on 
the correct line on the web page.

some programs can be started with many copies, i.e. odbedit, mdump, etc. the 
client names will be "program name" plus a number, i.e. odbedit, odbedit1, 
odbedit2, etc. these programs are grouped together on one line of the web page. 
grouping is done by matching client names against entries in ODB /Programs and 
this test sometimes misfires.

for example if there is an entry for "/Programs/odb", odbedit, odbedit1 & co, 
will show up on two lines of the web page, the normal "odbedit" line and the 
unexpected "odb" line. this is because name matching used truncation instead of 
a check for "program name plus a number".

similar malfunction happens if experiment has 2 frontends named "frontend" and 
"frontend_for_vme_readout". there will be 2 lines on the web page, one for each 
frontend, and "frontend_for_vme_readout" will show up on both lines (name check 
is done by truncating the name to "frontend".

this is now fixed by using the correct check for client name: "program name plus 
a number".

similar thing happens for indexed frontends ("frontend -i 1"), depending on how 
frontend equipments are setup, the client name will be "program name plus 
frontend index". the MIDAS Programs page may or may not match all such indexed 
frontends as one group and provide a common "stop" button for all of them. I am 
not sure if this accidental feature survives the current update.

the last malfunction happens with the Programs page "stop" button, it called 
cm_shutdown() with bUnique set to FALSE, and in the above example, shut down 
both programs, "frontend" and "frontend_for_vme_readout". Unexpected and 
undesired.

removal of bUnique from cm_shutdown() fixed this. to shut down multiple clients, 
the Programs page now makes a separate call for each one of them.

K.O.
ELOG V3.1.6-083448f7