[Home]

Summary:ASTERISK-17751: [patch] Random crashes (NULL reference) at res_odbc.c:1358
Reporter:Pablo Ruiz García (pruiz)Labels:
Date Opened:2011-04-25 17:06:17Date Closed:2011-05-03 13:51:43
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Resources/res_odbc
Versions:1.8.3 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) tmp.diff
Description:Randomly, a our asterisk servers (4 nodes running 1.8.3.2), crash due to an invalid/null reference at res_odbc.c

After inspecting the coredump files it is crearly a null reference, as can be seen on the following output from GDB:

#0  0x00002aaaabb526ac in _ast_odbc_request_obj2 (name=0x42037920 "sipper-con", flags=<value optimized out>, file=<value optimized out>, function=<value optimized out>,
   lineno=<value optimized out>) at res_odbc.c:1358
1358                    if (time(NULL) > class->last_negative_connect.tv_sec + class->negative_connection_cache.tv_sec) {
(gdb) bt
#0  0x00002aaaabb526ac in _ast_odbc_request_obj2 (name=0x42037920 "sipper-con", flags=<value optimized out>, file=<value optimized out>, function=<value optimized out>,
   lineno=<value optimized out>) at res_odbc.c:1358
#1  0x00002aaacda516b0 in update_odbc (database=0x42037920 "sipper-con", table=0x42037820 "sipregs1", keyfield=0x2aaaad715408 "name", lookup=<value optimized out>,
   ap=<value optimized out>) at res_config_odbc.c:497
#2  0x000000000047e441 in ast_update_realtime ()
#3  0x00002aaaad6fa101 in update_peer (p=0x2aaadc7f3ee8, addr=0x42039f10, req=0x420394b0, uri=<value optimized out>) at chan_sip.c:4231
#4  register_verify (p=0x2aaadc7f3ee8, addr=0x42039f10, req=0x420394b0, uri=<value optimized out>) at chan_sip.c:13856
ASTERISK-1  0x00002aaaad6fa63d in handle_request_register (p=0x2aaadc7f3ee8, req=0x420394b0, addr=0x42039f10, e=0x208fb001 "sip:77.240.122.36:5060") at chan_sip.c:23482
ASTERISK-2  0x00002aaaad70b8ce in handle_incoming (p=0x2aaadc7f3ee8, req=0x420394b0, addr=0x42039f10, recount=0x42039464, nounlock=0x42039460) at chan_sip.c:23752
ASTERISK-3  0x00002aaaad70c670 in handle_request_do (req=0x420394b0, addr=0x42039f10) at chan_sip.c:24036
ASTERISK-4  0x00002aaaad70cfb9 in sipsock_read (id=<value optimized out>, fd=<value optimized out>, events=<value optimized out>, ignore=<value optimized out>) at chan_sip.c:23934
ASTERISK-5  0x00000000004c0f13 in ast_io_wait ()
ASTERISK-6 0x00002aaaad6e015b in do_monitor (data=<value optimized out>) at chan_sip.c:24451
ASTERISK-7 0x000000000053104c in dummy_start ()
ASTERISK-8 0x00000030e420673d in start_thread () from /lib64/libpthread.so.0
ASTERISK-9 0x00000030e3ad3d1d in clone () from /lib64/libc.so.6
(gdb) p class
$1 = (struct odbc_class *) 0x0


Comments:By: Pablo Ruiz García (pruiz) 2011-04-25 17:30:11

See attached file (tmp.diff) for a patch fixing the issue.

By: Sean Bright (seanbright) 2011-04-28 10:48:55

This can be committed.

By: Digium Subversion (svnbot) 2011-05-03 13:49:49

Repository: asterisk
Revision: 316215

U   branches/1.8/res/res_odbc.c

------------------------------------------------------------------------
r316215 | dvossel | 2011-05-03 13:49:48 -0500 (Tue, 03 May 2011) | 9 lines

Fixes a random crash (NULL reference) in res_odbc.c.

(closes issue ASTERISK-17751)
Reported by: pruiz
Patches:
     tmp.diff uploaded by pruiz (license 1152)
Tested by: pruiz, seanbright


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=316215

By: Digium Subversion (svnbot) 2011-05-03 13:51:42

Repository: asterisk
Revision: 316216

_U  trunk/
U   trunk/res/res_odbc.c

------------------------------------------------------------------------
r316216 | dvossel | 2011-05-03 13:51:42 -0500 (Tue, 03 May 2011) | 15 lines

Merged revisions 316215 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r316215 | dvossel | 2011-05-03 13:49:48 -0500 (Tue, 03 May 2011) | 9 lines
 
 Fixes a random crash (NULL reference) in res_odbc.c.
 
 (closes issue ASTERISK-17751)
 Reported by: pruiz
 Patches:
       tmp.diff uploaded by pruiz (license 1152)
 Tested by: pruiz, seanbright
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=316216