[OpenSIPS-Devel] Segmentation fault on startup

Liviu Chircu liviu at opensips.org
Thu Apr 18 16:03:56 EDT 2019


Or maybe I went overboard with the mockup idea... a MySQL docker 
container with the OSIPS DB schema would be more than fine, and would 
allows us to immediately work on the code that's actually useful.

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 18.04.2019 22:59, Liviu Chircu wrote:
> Excellent catch!  Your use case (opensips -c ...) completely slipped 
> my mind!  Thinking more about this, if we had a "test DB" in-memory 
> implementation of the DB API, we could unit test the crap out of these 
> little yet essential use cases.
>
> Liviu Chircu
> OpenSIPS Developer
> http://www.opensips-solutions.com
>
> On 18.04.2019 20:03, Dan Pascu wrote:
>> Fixed this one, you can disregard it.
>>
>> On 18 Apr 2019, at 18:36, Dan Pascu wrote:
>>
>>> I'm attempting to check my config with opensips -c -f opensips.cfg 
>>> and it crashes loading the tracer module (when it tries to query the 
>>> table version - FYI mysql runs and I can access it with the opensips 
>>> credentials and successfully query the table version from a mysql 
>>> client):
>>>
>>> Apr 18 18:29:58 [32271] INFO:tracer:parse_siptrace_id: allocating 
>>> 1206818306 [default]
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> tracer.c:parse_siptrace_id:599: malloc 0xb934e430 size 380 end 
>>> 0xb934e5ac
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> tracer.c:get_db_struct:324: malloc 0xb9340c30 size 92 end 0xb9340c8c
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db.c:db_bind_mod:212: malloc 0xb9348580 size 72 end 0xb93485c8
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db.c:db_bind_mod:229: malloc 0xb932d6f0 size 12 end 0xb932d6fc
>>> Apr 18 18:29:58 [32271] DBG:core:sys_free: db/db.c:db_bind_mod:237: 
>>> free 0xb9348580
>>> Apr 18 18:29:58 [32271] DBG:core:find_mod_export: found 
>>> <db_bind_api> in module db_mysql 
>>> [/home/dan/work/voip/opensips/build/test-3.0/opensips-xs/modules/]
>>> Apr 18 18:29:58 [32271] DBG:core:db_bind_mod: using db bind api for 
>>> db_mysql
>>> Apr 18 18:29:58 [32271] DBG:core:sys_free: db/db.c:db_bind_mod:281: 
>>> free 0xb932d6f0
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: db/db.c:db_do_init:314: 
>>> malloc 0xb9349940 size 100 end 0xb93499a4
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db_id.c:new_db_id:273: malloc 0xb93469f0 size 36 end 0xb9346a14
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db_id.c:dupl_string:47: malloc 0xb932d6f0 size 6 end 0xb932d6f6
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db_id.c:dupl_string:47: malloc 0xb932b230 size 9 end 0xb932b239
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db_id.c:dupl_string:47: malloc 0xb9340cd0 size 33 end 0xb9340cf1
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db_id.c:dupl_string:47: malloc 0xb932aed0 size 10 end 0xb932aeda
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> db/db_id.c:dupl_string:47: malloc 0xb9326180 size 9 end 0xb9326189
>>> Apr 18 18:29:58 [32271] DBG:core:db_do_init: connection 0xb93469f0 
>>> not found in pool
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> my_con.c:db_mysql_new_connection:148: malloc 0xb93458a0 size 52 end 
>>> 0xb93458d4
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: 
>>> my_con.c:db_mysql_new_connection:157: malloc 0xb934e860 size 964 end 
>>> 0xb934ec24
>>> Apr 18 18:29:58 [32271] DBG:db_mysql:db_mysql_connect: opening 
>>> connection: mysql://xxxx:xxxx@localhost/opensips
>>> Apr 18 18:29:58 [32271] DBG:db_mysql:db_mysql_connect: connection 
>>> type is Localhost via UNIX socket
>>> Apr 18 18:29:58 [32271] DBG:db_mysql:db_mysql_connect: protocol 
>>> version is 10
>>> Apr 18 18:29:58 [32271] DBG:db_mysql:db_mysql_connect: server 
>>> version is 5.7.24-1
>>> Apr 18 18:29:58 [32271] DBG:core:db_do_init: connection 0xb93469f0 
>>> inserted in pool as 0xb93458a0
>>> Apr 18 18:29:58 [32271] DBG:core:sys_malloc: db/db.c:db_do_init:352: 
>>> malloc 0xb9340f80 size 80 end 0xb9340fd0
>>> Segmentation fault (core dumped)
>>>
>>> Core was generated by `./opensips -c -f o.cfg'.
>>> Program terminated with signal SIGSEGV, Segmentation fault.
>>> #0  0xb4e7304b in db_mysql_submit_query (_h=0xb9349940, 
>>> _s=0xb77c35a0 <sql_str>) at dbase.c:299
>>> 299            _stop_expire_timer(start, 
>>> db_mysql_exec_query_threshold, "mysql query",
>>> (gdb) bt
>>> #0  0xb4e7304b in db_mysql_submit_query (_h=0xb9349940, 
>>> _s=0xb77c35a0 <sql_str>) at dbase.c:299
>>> #1  0xb7639011 in db_do_query (_h=0xb9349940, _k=0xbfcf1820, 
>>> _op=0x0, _v=0xbfcf1828, _c=0xbfcf1824, _n=1, _nc=1, _o=0x0, 
>>> _r=0xbfcf1800, val2str=0xb4e6c600 <db_mysql_val2str>, 
>>> submit_query=0xb4e72e60 <db_mysql_submit_query>, store_result=
>>>     0xb4e6e9b0 <db_mysql_store_result>) at db/db_query.c:99
>>> #2  0xb4e749c4 in db_mysql_query (_h=0xb9349940, _k=0xbfcf1820, 
>>> _op=0x0, _v=0xbfcf1828, _c=0xbfcf1824, _n=1, _nc=1, _o=0x0, 
>>> _r=0xbfcf1800) at dbase.c:979
>>> #3  0xb7631282 in db_table_version (dbf=0xb9340c3c, 
>>> connection=0xb9349940, table=0xb9340c84) at db/db.c:428
>>> #4  0xb76317ab in db_check_table_version (dbf=0xb9340c3c, 
>>> dbh=0xb9349940, table=0xb9340c84, version=5) at db/db.c:472
>>> #5  0xb3f86043 in get_db_struct (tb_name=0xbfcf1914, 
>>> st_db=0xb934e44c, url=0xbfcf190c) at tracer.c:354
>>> #6  parse_siptrace_id (suri=<synthetic pointer>) at tracer.c:612
>>> #7  parse_trace_id (type=<optimized out>, val=<optimized out>) at 
>>> tracer.c:642
>>> #8  0xb7595f28 in set_mod_param_regex (regex=0xb934c760 "tracer", 
>>> name=0xb934c950 "trace_id", type=1, val=0xb934c8c0) at modparam.c:87
>>> #9  0xb7682dea in yyparse () at cfg.y:1320
>>> #10 0xb7528d06 in parse_opensips_cfg (cfg_file=0xbfcf2fb0 "o.cfg", 
>>> preproc_cmdline=0x0, ret_stream=0x0) at cfg_pp.c:100
>>> #11 0xb74fb075 in main (argc=<optimized out>, argv=<optimized out>) 
>>> at main.c:1203
>>> (gdb) list
>>> 294         */
>>> 295
>>> 296        for (i=0; i<max_db_queries; i++) {
>>> 297 start_expire_timer(start,db_mysql_exec_query_threshold);
>>> 298            code = wrapper_single_mysql_real_query(_h, _s);
>>> 299            _stop_expire_timer(start, 
>>> db_mysql_exec_query_threshold, "mysql query",
>>> 300                        _s->s, _s->len, 0, sql_slow_queries, 
>>> sql_total_queries);
>>> 301            if (code < 0) {
>>> 302                /* got disconnected during call */
>>> 303                switch_state_to_disconnected(_h);
>>> (gdb) print start
>>> $1 = {tv_sec = 1713186560, tv_usec = -1187735232}
>>> (gdb) print db_mysql_exec_query_threshold
>>> $2 = 0
>>> (gdb) print _s
>>> $3 = (const str *) 0xb77c35a0 <sql_str>
>>> (gdb) print *_s
>>> $4 = {s = 0xb77b35a0 <sql_buf> "select table_version from version 
>>> where table_name='sip_trace'", len = 62}
>>> (gdb) print sql_slow_queries
>>> $5 = (stat_var *) 0x0
>>> (gdb) print sql_total_queries
>>> $6 = (stat_var *) 0x0
>>> (gdb)
>>>
>>> -- 
>>> Dan
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>
>> -- 
>> Dan
>>
>>
>>
>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel



More information about the Devel mailing list