Deletion of shared memory fails

Issue #363 resolved
Stefan Ritt created an issue

Since I while I get an error under MacOSX 13.2.1 about deleting of the midas shared memory. I turned on shm_trace in system.cxx and see following when I start and stop odbedit:

$ odbedit
ss_shm_open("ODB",1183808,1), mem_name [SM_ODB], file_name [/Users/ritt/online/.ODB.SHM], shm_name [/Default_ODB_SHM]
ss_shm_open("ODB",1183808) get_size 1, file_name /Users/ritt/online/.ODB.SHM, size 20135232
ss_shm_open("SYSMSG",116444,0), mem_name [SM_SYSMSG], file_name [/Users/ritt/online/.SYSMSG.SHM], shm_name [/Default_SYSMSG_SHM]
ss_shm_open("SYSMSG",116444) get_size 0, file_name /Users/ritt/online/.SYSMSG.SHM, size 0
[local:MEG:S]/>q
ss_shm_close("SYSMSG",0x1005ec000,116444,2,destroy_flag=1), file_name [/Users/ritt/online/.SYSMSG.SHM]
ss_shm_close("SYSMSG"), destroy_flag 1
ss_shm_delete("SYSMSG") file_name [/Users/ritt/online/.SYSMSG.SHM] shm_name [/MEG_SYSMSG_SHM]
ss_shm_delete("SYSMSG") shm_name /MEG_SYSMSG_SHM
[ODBEdit,ERROR] [system.cxx:1023:ss_shm_delete,ERROR] shm_unlink(/MEG_SYSMSG_SHM) errno 2 (No such file or directory)
ss_shm_flush("ODB",0x104600000,20135232,1), file_name [/Users/ritt/online/.ODB.SHM]
ss_shm_close("ODB",0x104600000,20135232,1,destroy_flag=1), file_name [/Users/ritt/online/.ODB.SHM]
ss_shm_close("ODB"), destroy_flag 1
ss_shm_delete("ODB") file_name [/Users/ritt/online/.ODB.SHM] shm_name [/MEG_ODB_SHM]
ss_shm_delete("ODB") shm_name /MEG_ODB_SHM
[ODBEdit,ERROR] [system.cxx:1023:ss_shm_delete,ERROR] shm_unlink(/MEG_ODB_SHM) errno 2 (No such file or directory)

So it looks to me like the experiment name “MEG” is added to the shared memory name “shm_name” as “MEG_ODB_SHM” but as “Default_ODB_SHM” when it gets created. This is clear since the code does not know the experiment name before it attaches to the ODB. So the code needs reworking.

Comments (4)

  1. Stefan Ritt reporter

    This issue has been resolved by introducing MIDAS_EXPNAME. The problem was that the experiment name is used to be included in the shared memory name, so that several instances of midas can run on the same machine. If we have an exptab file, everything is fine, since the experiment name is knows before we open the shared memory. If we do not have an exptab file, then the name "Default" is used when creating the shared memory, and the real name from the ODB (under /Experiment/Name) is used when deleting the shared memory.

    To fix this, I introduced MIDAS_EXPNAME to go along with MIDAS_DIR. This now is more equivalent to the exptab file where we also have a name and a directory. I updated the documentation accordingly and made an announcement at the forum about this change.

  2. Log in to comment