[Home]

Summary:ASTERISK-23675: [patch] Segmentation Fault on first SIP registration using res_config_odbc
Reporter:Leandro Dardini (ldardini)Labels:
Date Opened:2014-04-25 19:51:24Date Closed:2014-05-06 08:13:14
Priority:CriticalRegression?Yes
Status:Closed/CompleteComponents:Resources/res_config_odbc
Versions:12.2.0 Frequency of
Occurrence
Constant
Related
Issues:
is caused byASTERISK-23459 [patch]Incorrect check for key field and NULL column values in update_odbc
is duplicated byASTERISK-23677 [res_odbc] Syntax error in peer registration
Environment:Linux, CentOS 6.5, 64bitAttachments:( 0) asterisk-23675-odbc-linkedlist-traversal_12.diff
( 1) backtrace.txt
Description:Starting with a perfectly working configuration for asterisk 12.1.1 using realtime sip peers via ODBC on MySQL server, compiled asterisk 12.2.0 and run, it crashes with segmentation fault when the first registration attempt is received from a phone.

Last part of backtrace:
{noformat}
Core was generated by `/usr/sbin/asterisk -f -vvvg -c'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f70708e9cb7 in update_odbc (database=0x7f706b848200 "asterisk1", table=0x7f706b848100 "sipfriends", keyfield=0x7f707ab6139b "name", lookup=0x7f70c006e3c8 "101-IDSSOFT", fields=0x7f70c000a8c0) at res_config_odbc.c:493
493             while ((field = field->next)) {
#0  0x00007f70708e9cb7 in update_odbc (database=0x7f706b848200 "asterisk1", table=0x7f706b848100 "sipfriends", keyfield=0x7f707ab6139b "name", lookup=0x7f70c006e3c8 "101-IDSSOFT", fields=0x7f70c000a8c0) at res_co
nfig_odbc.c:493
       obj = 0x3034d28
       stmt = 0x7f706b848100
       sql = "UPDATE sipfriends SET regserver=?, lastms=?, defaultuser=?, port=?", '\000' <repeats 14 times>"\377, \377\377\377\000\000\000\000\000\205\204kp\177", '\000' <repeats 26 times>"\223, uR\000\000\000\
000\000`\205\204k\000\000\070f\340\063\211\000\000\000\000\000\v*a\000\000\000\000\000\205\061a\000\000\000\000\000\377\377\377\377\354\t\000\000\364\"a\000\000\000\000\000\016*a\000\000\000\000\000y1a\000\000\00
0\000\000P\200\204kp\177\000\000\035HM\000\000\000\000\000ҙ$\002\000\000\000\000\240\200\204kp\177\000\000Ѐ\204kp\177\000\000\310IM\000\000\000\000\000\350\317\006\300p\177\000\000\220\201\204kp"...
       rowcount = 0
       field = 0x0
       res = 32624
       count = 4
       paramcount = 4
       cps = {sql = 0x7f706b847f70 "UPDATE sipfriends SET regserver=?, lastms=?, defaultuser=?, port=?", extra = 0x7f70c006e3c8 "101-IDSSOFT", __field_mgr_pool = 0x7f70c00797c0, encoding = {0x8c6e46 "" <repeats
256 times>}, __field_mgr = {last_alloc = 0x0, embedded_pool = 0x0}, fields = 0x7f70c000a8c0, skip = 0}
       tableptr = 0x31f8380
       column = 0x31f8510
       connected_flag = {flags = 4}
       __PRETTY_FUNCTION__ = "update_odbc"
#1  0x00000000004d5a6c in ast_update_realtime_fields (family=0x7f707ab61367 "sippeers", keyfield=0x7f707ab6139b "name", lookup=0x7f70c006e3c8 "101-IDSSOFT", fields=0x7f70c000a8c0) at config.c:2940
       eng = 0x7f7070aed760
       res = -1
       i = 1
{noformat}
Comments:By: Leandro Dardini (ldardini) 2014-04-25 19:52:19.683-0500

Backtrace

By: Michael L. Young (elguero) 2014-04-28 11:49:49.809-0500

I tried to recreate the segmentation fault but I wasn't able to.  Yet, I did get error messages on the console which indicated there is a problem.

Please try the attached patch and report back.  It cleared up the error messages that I was seeing when testing with 12.2.0.

By: Leandro Dardini (ldardini) 2014-04-28 13:56:03.918-0500

I have applied the patch and the system is performing perfectly now. Thank you.

By: Michael L. Young (elguero) 2014-04-28 15:03:23.668-0500

Thanks for the feedback.

You shouldn't close an issue out as being fixed since the patch has not been applied to the code base.

By: Matt Jordan (mjordan) 2014-05-02 15:13:35.354-0500

Yeah.... that should probably get merged :-)

By: Michael L. Young (elguero) 2014-05-06 08:13:14.790-0500

Mark merged this patch in.  This was not automatically closed as fixed so doing that now.