db_lock_database() not protected against ctrl-c handler, crash in odbedit find after ctrl-c

Issue #99 resolved
dd1 created an issue

I run odbedit, type the command "fin subrun" and while it is running, hit CTRL-C, and get this very interesting crash: (in DEAP they also report getting a corrupted ODB)

[local:agdaq:R]/>fin sunrun
^Codbedit: src/odb.c:1857: db_lock_database: Assertion `!_database[hDB - 1].protect_read' failed.
Aborted (core dumped)
[agdaq@alphagdaq ~]$ gdb ~olchansk/git/midas/linux/bin/odbedit core.11993 
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/olchansk/git/midas/linux/bin/odbedit...done.
[New LWP 11993]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/home/olchansk/git/midas/linux/bin/odbedit'.
Program terminated with signal 6, Aborted.
#0  0x00007f92cbca01f7 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-196.el7.x86_64 libgcc-4.8.5-16.el7.x86_64 libstdc++-4.8.5-16.el7.x86_64 zlib-1.2.7-17.el7.x86_64
(gdb) bt
#0  0x00007f92cbca01f7 in raise () from /lib64/libc.so.6
#1  0x00007f92cbca18e8 in abort () from /lib64/libc.so.6
#2  0x00007f92cbc99266 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007f92cbc99312 in __assert_fail () from /lib64/libc.so.6
#4  0x000000000042e212 in db_lock_database (hDB=hDB@entry=1) at src/odb.c:1857
#5  0x000000000040dcaf in cm_delete_client_info (hDB=1, pid=11993) at src/midas.c:1616
#6  0x0000000000422147 in cm_disconnect_experiment () at src/midas.c:2571
#7  0x0000000000405331 in ctrlc_odbedit (i=<optimized out>) at src/odbedit.cxx:2745
#8  <signal handler called>
#9  0x00007f92cbd5da57 in mprotect () from /lib64/libc.so.6
#10 0x0000000000426ea3 in ss_shm_protect (handle=0, adr=0x7f92cb4a8000) at src/system.c:1073
#11 0x000000000042e495 in db_unlock_database (hDB=<optimized out>) at src/odb.c:1938
#12 0x00000000004330c1 in db_get_link (hDB=1, hKey=<optimized out>, key=0x7fffb4b5fef0) at src/odb.c:4791
#13 0x00000000004330f8 in db_scan_tree (hDB=hDB@entry=1, hKey=320624, level=level@entry=6, callback=callback@entry=0x405ad0 <search_key(int, int, KEY*, int, void*)>, 
    info=info@entry=0x7fffb4b62920) at src/odb.c:3661
#14 0x0000000000433174 in db_scan_tree (hDB=hDB@entry=1, hKey=319888, level=level@entry=5, callback=callback@entry=0x405ad0 <search_key(int, int, KEY*, int, void*)>, 
    info=info@entry=0x7fffb4b62920) at src/odb.c:3676
#15 0x0000000000433174 in db_scan_tree (hDB=hDB@entry=1, hKey=311016, level=level@entry=4, callback=callback@entry=0x405ad0 <search_key(int, int, KEY*, int, void*)>, 
    info=info@entry=0x7fffb4b62920) at src/odb.c:3676
#16 0x0000000000433174 in db_scan_tree (hDB=hDB@entry=1, hKey=219560, level=level@entry=3, callback=callback@entry=0x405ad0 <search_key(int, int, KEY*, int, void*)>, 
    info=info@entry=0x7fffb4b62920) at src/odb.c:3676
#17 0x0000000000433174 in db_scan_tree (hDB=hDB@entry=1, hKey=214368, level=level@entry=2, callback=callback@entry=0x405ad0 <search_key(int, int, KEY*, int, void*)>, 
    info=info@entry=0x7fffb4b62920) at src/odb.c:3676
---Type <return> to continue, or q <return> to quit---
#18 0x0000000000433174 in db_scan_tree (hDB=hDB@entry=1, hKey=211968, level=level@entry=1, callback=callback@entry=0x405ad0 <search_key(int, int, KEY*, int, void*)>, 
    info=info@entry=0x7fffb4b62920) at src/odb.c:3676
#19 0x0000000000433174 in db_scan_tree (hDB=1, hKey=135232, level=0, callback=0x405ad0 <search_key(int, int, KEY*, int, void*)>, info=0x7fffb4b62920) at src/odb.c:3676
#20 0x000000000040aa7e in command_loop (host_name=host_name@entry=0x7fffb4b67010 "", exp_name=exp_name@entry=0x7fffb4b66ff0 "agdaq", cmd=cmd@entry=0x7fffb4b67210 "", 
    start_dir=start_dir@entry=0x7fffb4b67110 "") at src/odbedit.cxx:1870
#21 0x0000000000404119 in main (argc=<optimized out>, argv=<optimized out>) at src/odbedit.cxx:2875
(gdb) 

Comments (2)

  1. Log in to comment