#623 crash during start with location with db_cachedb

trunk
closed
modules (454)
5
2013-06-27
2013-03-06
Ovidiu Sas
No

During startup, opensips crashes:
loadmodule "cachedb_mongodb.so"
modparam("cachedb_mongodb", "cachedb_url","mongodb:instance1://localhost:27017/db.collection")
loadmodule "db_cachedb.so"
modparam("db_cachedb","cachedb_url","mongodb:instance1://localhost:27017/db.collection")
loadmodule "usrloc.so"
modparam("usrloc", "db_url", "cachedb://mongodb:instance1")
modparam("usrloc", "db_mode", 3)

Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000000 in ?? ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.7.x86_64 json-c-0.10-2.el6.x86_64 keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.9-33.el6_3.3.x86_64 libcom_err-1.41.12-12.el6.x86_64 libselinux-2.0.94-5.3.el6.x86_64 libxml2-2.7.6-8.el6_3.4.x86_64 mysql-libs-5.1.67-1.el6_3.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64 openssl-1.0.0-25.el6_3.1.x86_64 pcre-7.8-4.el6.x86_64 zlib-1.2.3-27.el6.x86_64
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ff54bcfe301 in get_all_db_ucontacts (buf=<value optimized out>, len=0, flags=1, part_idx=0, part_max=30) at dlist.c:159
#2 get_all_ucontacts (buf=<value optimized out>, len=0, flags=1, part_idx=0, part_max=30) at dlist.c:406
#3 0x00007ff549a7162e in nh_timer (ticks=<value optimized out>, timer_idx=0x0) at nathelper.c:1175
#4 0x00000000004bf4de in timer_ticker () at timer.c:384
#5 run_timer_process () at timer.c:471
#6 start_timer_processes () at timer.c:610
#7 0x000000000043376e in main_loop (argc=<value optimized out>, argv=<value optimized out>) at main.c:958
#8 main (argc=<value optimized out>, argv=<value optimized out>) at main.c:1557
(gdb) print ul_dbh
$1 = (db_con_t *) 0x7ff5506aa8c8
(gdb) print *ul_dbh
$2 = {table = 0x0, curr_ps = 0x0, ins_list = 0x0, tail = 140691593440536, url = {s = 0x0, len = 0}, flags = 0}

Regards,
Ovidiu Sas

Discussion

  • Ovidiu Sas
    Ovidiu Sas
    2013-03-06

    Note: if db_mode is set to 1, everything works ok.

     
    • assigned_to: nobody --> vladut-paiu
     
  • I guess the problem is that USRLOC module, in DB_ONLY mode is using a raw query to select the contacts to ping. And AFAIK, raw queries are not supported by the db_cachedb module.

    Basically you hit an impossible scenario - nevertheless it should not crash :).

    Regards,
    Bogdan

     
  • Hello,

    I have committed a fix for this in OpenSIPS trunk.
    The crash was related to the nathelper module trying to do a raw query against the location table. Since there's currently no way to convert raw SQL to the cachedb interface, I have set the raw_query call to always fail, instead of it crashing

    Best Regards,
    Vlad

     
    • status: open --> closed
     
  • joelk
    joelk
    2013-06-27

    We have exactly the same bug with Opensips 1.9.1 with db_mode=3 and mysql database (no cache). It seems a part of code in dlist.c (usrloc module) is called only if db_mode=3 and make opensips crashes in some circumstances. No able to reproduce it manually, crash is random

    Program terminated with signal 11, Segmentation fault.
    #0  0x00002b23fb72f2f6 in get_all_db_ucontacts (buf=0x2b23f982d458, len=<value optimized out>, flags=1, part_idx=2, part_max=10) at dlist.c:176
    176                                     if (VAL_NULL(ROW_VALUES(row)+1) || p==0 || p[0]==0) {
    
    (gdb) bt
    #0  0x00002b23fb72f2f6 in get_all_db_ucontacts (buf=0x2b23f982d458, len=<value optimized out>, flags=1, part_idx=2, part_max=10) at dlist.c:176
    #1  get_all_ucontacts (buf=0x2b23f982d458, len=<value optimized out>, flags=1, part_idx=2, part_max=10) at dlist.c:408 
    #2  0x00002b23fc61d4b7 in nh_timer (ticks=<value optimized out>, timer_idx=<value optimized out>) at nathelper.c:1175
    #3  0x00000000004a4551 in run_timer_process () at timer.c:384
    #4  start_timer_processes () at timer.c:610
    #5  0x0000000000432a8b in main_loop (argc=<value optimized out>, argv=0x7fffc23d8e58) at main.c:958
    #6  main (argc=<value optimized out>, argv=0x7fffc23d8e58) at main.c:1557
    
     
    Last edit: joelk 2013-06-28