crash due to empty "/Logger/History dir"

Create issue
Issue #237 resolved
dd1 created an issue

mhttpd.cxx automatically creates an empty ODB “/Logger/History dir” (i.e. in mhttpd.cxx) and causes a crash . This causes a crash in MidasHistory::hs_connect () because hs_set_path(““) is not permitted. The code that calls hs_set_path() is wrong, too, it should check that /Logger/History dir and /Logger/Data dir are not empty. Also should use db_get_value_string(). Since traditionally we do automatically not create “/Logger/History dir”, I fix mhttpd.cxx first. I will fix callers of hs_set_path() later. K.O.

(gdb) bt
#0 0x00007f4b08e83387 in raise () from /lib64/libc.so.6
#1 0x00007f4b08e84a78 in abort () from /lib64/libc.so.6
#2 0x00007f4b08e7c1a6 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007f4b08e7c252 in __assert_fail () from /lib64/libc.so.6
#4 0x00000000004baac0 in hs_set_path (path=0x7ffdb5251060 "") at /home/agmini/packages/midas/src/history.cxx:193
#5 MidasHistory::hs_connect (this=0x25c4120, unused_connect_string=<optimized out>) at /home/agmini/packages/midas/src/history.cxx:2363
#6 0x000000000046e137 in hs_get_history (hDB=1, hKey=1679776, flags=flags@entry=2, debug_flag=0, mh=mh@entry=0x7ffdb5251650)
at /home/agmini/packages/midas/src/history_common.cxx:80
#7 0x0000000000425729 in open_history () at /home/agmini/packages/midas/progs/mlogger.cxx:4639
#8 0x000000000041cdf4 in main (argc=2, argv=0x7ffdb5251de8) at /home/agmini/packages/midas/progs/mlogger.cxx:6158

K.O.

Comments (2)

  1. Stefan Ritt

    I mildly disagree with this solution. An empty “/Logger/History dir” or “/Logger/Data dir” tells the user that one can put in here some directory. I know some installations which have the history directory and the data directory on different paths, even different hard disks. Without the empty directories, the user does not know about this possibility and has to read the documentation very carefully until he or she find it there. I often find myself at some experiment where I want to change the data directory. Then I wonder where to do it. I always forget if it’s “Data directory” or “Data Dir” or something else, so an empty ODB entry guides me the way.

    So the bug should not be fixed by removing the empty directories, but by the code in hs_set_path which uses those directories.

  2. Log in to comment