[Home]

Summary:ASTERISK-17127: Segmentation fault when using dynamic hints and func_odbc
Reporter:Bertrand B. (bertrand)Labels:
Date Opened:2010-12-17 08:58:25.000-0600Date Closed:2011-05-13 13:10:47
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Channels/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) backtrace.txt
( 1) backtrace-threads.txt
Description:I'm running Debian Squeeze amd64. I'm using asterisk 1.8.1.1 which I compiled with the following Compiler Flags: DONT_OPTIMIZE and DEBUG_THREADS.

The crash only occurs when asterisk is launched in background (or with start-stop-daemon). Asterisk does not crash when it is launched using options -c, -v, or -f (or with setsid).

Asterisk crash when a SIP client try to subscribe to a dynamic hint. These dynamic hints works well when asterisk is not running in background.


****** STEPS TO REPRODUCE ******

Here is my ODBC function (func_odbc.conf):
[HINTS]
dsn=asterisk
readsql=SELECT `channels` FROM `hints` WHERE `exten`='${SQL_ESC(${ARG1})}'

Here is my hint extension (extensions.conf):
exten => _XXXX,hint,${ODBC_HINTS(${EXTEN})}
Comments:By: Bertrand B. (bertrand) 2010-12-17 09:01:24.000-0600

Here is my ODBC function (func_odbc.conf):
[HINTS]
dsn=asterisk
readsql=SELECT `channels` FROM `hints` WHERE `exten`='${SQL_ESC(${ARG1})}'

Here is my hint extension (extensions.conf):
exten => _XXXX,hint,${ODBC_HINTS(${EXTEN})}

By: Leif Madsen (lmadsen) 2010-12-20 08:56:45.000-0600

Please also execute:  bt full, and thread apply all bt, when doing your backtrace.

By: Bertrand B. (bertrand) 2010-12-20 09:13:38.000-0600

Sorry, I forgot to attach the thread apply all backtrace. The backtrace full is in the backtrace.txt.

One fix that might work is to change the comparison of the line 3764 in channel.c:
from '(chan->tech->read)' to '(chan->tech && chan->tech->read)'.

However, I am not sure if this is normal that chan->tech == NULL.

By: Digium Subversion (svnbot) 2011-05-13 13:09:35

Repository: asterisk
Revision: 318921

U   branches/1.8/main/channel.c

------------------------------------------------------------------------
r318921 | bbryant | 2011-05-13 13:09:35 -0500 (Fri, 13 May 2011) | 8 lines

Fixes a segmentation fault in dynamic hints when a channel technology isn't
loaded for a hint.

(closes issue ASTERISK-17127)
Reported by: bertrand
Tested by: bertrand


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

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

By: Digium Subversion (svnbot) 2011-05-13 13:10:46

Repository: asterisk
Revision: 318922

_U  trunk/
U   trunk/main/channel.c

------------------------------------------------------------------------
r318922 | bbryant | 2011-05-13 13:10:46 -0500 (Fri, 13 May 2011) | 14 lines

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

........
 r318921 | bbryant | 2011-05-13 14:09:34 -0400 (Fri, 13 May 2011) | 8 lines
 
 Fixes a segmentation fault in dynamic hints when a channel technology isn't
 loaded for a hint.
 
 (closes issue ASTERISK-17127)
 Reported by: bertrand
 Tested by: bertrand
........

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

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