#555 do_routing function crash without group id parameter

1.7.x
open-accepted
modules (454)
5
2012-10-12
2012-08-30
piero ferraresso
No

I\'m using opensips v. 1.7.2-TLS on a Debian 6.04 machine.
If I call the function do_routing without specifing the group id parameter - do_routing(\"\",\"1\") for example - opensips crah (segfault at 0 ip 081399d8 sp bfed0480 error 4 in opensips[8048000+150000]).
If I insert the group id - do_routing(\"0\",\"1\") for example - all works fine.
Where do I wrong?

Thanks in advance

Piero Ferraresso

Discussion

  • output with debug=8

     
    Attachments
    • priority: 5 --> 6
     
  • gdb bt full core dump

     
    Attachments
    • assigned_to: nobody --> bogdan_iancu
     
  • Hi Piero,

    Could you try without the db_virtual module (direct query to mysql) to see if you still have this issue ?

    Thanks and regards,
    Bogdan

     
  • I tried to reproduce this, using 1.7 :

    if (!do_routing("","1")) {
    xlog("----DR failed !!\n");
    exit;
    }

    But with no success - I get error messages with no crash:

    Sep 17 12:34:54 [6354] DBG:core:parse_to_param: tag=fuzyi
    Sep 17 12:34:54 [6354] DBG:core:parse_to: end of header reached, state=29
    Sep 17 12:34:54 [6354] DBG:core:parse_to: display={"bogdan"}, ruri={sip:bogdan@opensips.org}
    Sep 17 12:34:54 [6354] DBG:core:db_new_result: allocate 48 bytes for result set at 0x7cc598
    Sep 17 12:34:54 [6354] DBG:db_mysql:db_mysql_get_columns: 1 columns returned from the query
    Sep 17 12:34:54 [6354] DBG:core:db_allocate_columns: allocate 28 bytes for result columns at 0x7cc5e0
    Sep 17 12:34:54 [6354] DBG:db_mysql:db_mysql_get_columns: RES_NAMES(0x7cc5e8)[0]=[groupid]
    Sep 17 12:34:54 [6354] DBG:db_mysql:db_mysql_get_columns: use DB_INT result type
    Sep 17 12:34:54 [6354] DBG:db_mysql:db_mysql_convert_rows: no rows returned from the query
    Sep 17 12:34:54 [6354] ERROR:drouting:get_group_id: no group for user "bogdan"@"opensips.org"
    Sep 17 12:34:54 [6354] DBG:core:db_free_columns: freeing result columns at 0x7cc5e0
    Sep 17 12:34:54 [6354] DBG:core:db_free_rows: freeing 0 rows
    Sep 17 12:34:54 [6354] DBG:core:db_free_result: freeing result set at 0x7cc598
    Sep 17 12:34:54 [6354] ERROR:drouting:do_routing: failed to get group id
    Sep 17 12:34:54 [6354] DBG:core:buf_init: initializing...
    ----DR failed !!

    Maybe it is something particular to your case, so please provide an backtrace.

    Regards,
    Bogdan

     
    • priority: 6 --> 3
    • status: open --> open-works-for-me
     
  • Yes, It seems to depend on using the virtual db module.

    Piero

     
  • Please post the db virtual configuration you are using for the DR module. And one again, if you get a core file, extract please the backtrace from it.

    Regards,
    Bogdan

     
  • This is my actual configuration:

    #db_default_url="virtual://set1" # parallel
    db_default_url="virtual://set2" # failover
    #db_default_url="virtual://set3" # round

    #Setting module-specific parameters

    # DB_virtual
    modparam("db_virtual", "db_probe_time", 10)#default 10 sec
    modparam("db_virtual", "db_max_consec_retrys", 3)#default 10 consecutive times

    modparam("db_virtual", "db_urls", "define set1 PARALLEL")
    modparam("db_virtual", "db_urls", "mysql://opensips:xxx@sqlnode1/opensips17")
    modparam("db_virtual", "db_urls", "mysql://opensips:xxx@sqlnode2/opensips17")

    modparam("db_virtual", "db_urls", "define set2 FAILOVER")
    modparam("db_virtual", "db_urls", "mysql://opensips:xxx@localhost/opensips17")
    modparam("db_virtual", "db_urls", "mysql://opensips:xxx@sqlnode1/opensips17")
    modparam("db_virtual", "db_urls", "mysql://opensips:xxx@sqlnode2/opensips17")

    modparam("db_virtual", "db_urls", "define set3 ROUND")
    modparam("db_virtual", "db_urls", "mysql://opensips:xx@sqlnode1/opensips17")
    modparam("db_virtual", "db_urls", "mysql://opensips:xx@sqlnode2/opensips17")

    # Dynamic Routing + Load Balancer

    modparam("drouting", "use_domain", 0)
    modparam("drouting", "probing_interval", 60)
    modparam("drouting", "probing_from", "sip:pinger@si.unimib.it")
    modparam("drouting", "probing_method", "OPTIONS")
    modparam("drouting", "probing_reply_codes", "501, 403, 404")

     
  • Still working (even if db_virtual):

    Sep 18 14:49:33 [12557] DBG:core:parse_to_param: tag=fuzyi
    Sep 18 14:49:33 [12557] DBG:core:parse_to: end of header reached, state=29
    Sep 18 14:49:33 [12557] DBG:core:parse_to: display={"bogdan"}, ruri={sip:bogdan@opensips.org}
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_query: f call
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_query: f call handle size = 2
    Sep 18 14:49:33 [12557] DBG:db_virtual:try_reconnect: try reconnect
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_query: flags1 = 3
    Sep 18 14:49:33 [12557] DBG:core:db_new_result: allocate 48 bytes for result set at 0x7cf908
    Sep 18 14:49:33 [12557] DBG:db_mysql:db_mysql_get_columns: 1 columns returned from the query
    Sep 18 14:49:33 [12557] DBG:core:db_allocate_columns: allocate 28 bytes for result columns at 0x7cfb88
    Sep 18 14:49:33 [12557] DBG:db_mysql:db_mysql_get_columns: RES_NAMES(0x7cfb90)[0]=[groupid]
    Sep 18 14:49:33 [12557] DBG:db_mysql:db_mysql_get_columns: use DB_INT result type
    Sep 18 14:49:33 [12557] DBG:db_mysql:db_mysql_convert_rows: no rows returned from the query
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_query: curent_con = 0
    Sep 18 14:49:33 [12557] ERROR:drouting:get_group_id: no group for user "bogdan"@"opensips.org"
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_free_result: f call
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_free_result: f call handle size = 2
    Sep 18 14:49:33 [12557] DBG:db_virtual:try_reconnect: try reconnect
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_free_result: flags1 = 3
    Sep 18 14:49:33 [12557] DBG:core:db_free_columns: freeing result columns at 0x7cfb88
    Sep 18 14:49:33 [12557] DBG:core:db_free_rows: freeing 0 rows
    Sep 18 14:49:33 [12557] DBG:core:db_free_result: freeing result set at 0x7cf908
    Sep 18 14:49:33 [12557] DBG:db_virtual:db_virtual_free_result: curent_con = 0
    Sep 18 14:49:33 [12557] ERROR:drouting:do_routing: failed to get group id
    Sep 18 14:49:33 [12557] DBG:core:buf_init: initializing...
    ----DR failed !!
    Sep 18 14:49:33 [12557] DBG:core:destroy_avp_list: destroying list (nil)

     
  • Post the opensips logs (with debug 6) corresponding to the INVITE processing.

     
  • output with debug=6

     
    Attachments
  • I've got the some problem also with the latest stable release (1.8.1.-TLS).

    Piero

     
  • Hi Piero,

    in GDB, in frame 0, could you do:

    p _h
    p *_h
    p _h->table->s

    Thanks and regards,
    Bogdan

     
    • priority: 3 --> 5
    • status: open-works-for-me --> open-accepted
     
  • I've just installed the latest version (1.8.2). This time I get this error on the syslog: "CRITICAL:db_mysql:wrapper_single_mysql_real_query: driver error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '#017 where username='prove'' at line 1
    Nov 2 14:30:07 proxysiptest /sbin/opensips[28858]: ERROR:core:db_do_query: error while submitting query - [select groupid from #017 where username='prove']".
    I've also executed the comands in GDB as you sugget, but after the "frame 0" and "p _h" commands I get: "No symbol "_h" in current context"