[Home]

Summary:ASTERISK-14472: [patch] Segfault - Perhaps in sig_analog.c
Reporter:Michael L. Young (elguero)Labels:
Date Opened:2009-07-15 12:52:46Date Closed:2009-07-17 12:04:36
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Channels/chan_dahdi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) backtrace.2771
( 1) backtrace.txt
( 2) backtrace-full.2771
( 3) backtrace-full.txt
( 4) cur.patch
( 5) cur2.patch
Description:Asterisk is segfaulting when an incoming call from a PRI span is being sent (dial) on to analog group.

I will attach a backtrace.  This has happened three times and I was able to catch it the last time.
Comments:By: Jeff Peeler (jpeeler) 2009-07-15 18:05:05

I haven't been able to reproduce this yet. Are you able to have the crash occur when just one call is coming in?

By: Jeff Peeler (jpeeler) 2009-07-15 19:01:33

Actually, try and see if that patch fixes the problem.

By: Michael L. Young (elguero) 2009-07-15 21:32:46

It appears to occur when there is more than one call.  When I updated, I obviously tested it and it was working fine with just one call.  But during the day, we had a couple calls going on it and it would segfault and I saw it segfault when I had several calls going on.

I am going to give this patch a try and report the results.

Thanks



By: Michael L. Young (elguero) 2009-07-15 22:38:59

Unfortunately, it is not advancing the channel at all when trying to allocate with this patch.  Here is what is happening with that patch applied.  You will see the first call comes in and is allocated properly.  The second call comes in and it is sent to channel 120 which is currently in use.  I hang up and try again and it continues to try and send the call to channel 120.

-- Accepting call from '9784169999' to '0000' on channel 0/5, span 2
   -- Executing Wait("DAHDI/29-1", "2")
   -- Executing NoOp("DAHDI/29-1", "Setting CallerID")
   -- Executing Set("DAHDI/29-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/29-1", "DAHDI/G25,,")
   -- Called G25
   -- DAHDI/120-1 is ringing
   -- DAHDI/120-1 is ringing
   -- DAHDI/120-1 answered DAHDI/29-1
   -- Native bridging DAHDI/29-1 and DAHDI/120-1
   -- Accepting call from '9785699999' to '0000' on channel 0/3, span 2
   -- Executing Wait("DAHDI/27-1", "2")
   -- Executing NoOp("DAHDI/27-1", "Setting CallerID")
   -- Executing Set("DAHDI/27-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/27-1", "DAHDI/G25,,")
[Jul 15 23:02:36] WARNING[29796]: chan_dahdi.c:3371 alloc_sub: Callwait subchannel of 120 already in use
[Jul 15 23:02:36] ERROR[29796]: sig_analog.c:598 analog_request: Unable to alloc subchannel
[Jul 15 23:02:36] WARNING[29796]: app_dial.c:1884 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 17 - User busy)
 == Everyone is busy/congested at this time (1:1/0/0)
   -- Auto fallthrough, channel 'DAHDI/27-1' status is 'BUSY'
   -- Hungup 'DAHDI/27-1'
   -- Channel 0/5, span 2 got hangup request, cause 16
   -- Hanging up on 'DAHDI/120-1'
   -- Hungup 'DAHDI/120-1'
 == Spawn extension (pbx2_pri2_in, 0000, 4) exited non-zero on 'DAHDI/29-1'
   -- Hungup 'DAHDI/29-1'

Without the patch, you will see that the first call comes in.  The second call is then sent to channel 120 which is in use.  I hung up and tried again.  This time the call was sent to 119.  But upon hanging up, asterisk segfaulted.  I believe that I hung up the first call and then the second.  I don't remember too well now.

-- Accepting call from '9784169999' to '0000' on channel 0/7, span 2
   -- Executing Wait("DAHDI/31-1", "2")
   -- Executing NoOp("DAHDI/31-1", "Setting CallerID")
   -- Executing Set("DAHDI/31-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/31-1", "DAHDI/G25,,")
   -- Called G25
   -- DAHDI/120-1 is ringing
   -- DAHDI/120-1 is ringing
   -- Accepting call from '9785699999' to '0000' on channel 0/14, span 2
   -- Executing Wait("DAHDI/38-1", "2")
   -- Executing NoOp("DAHDI/38-1", "Setting CallerID")
   -- Executing Set("DAHDI/38-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/38-1", "DAHDI/G25,,")
[Jul 15 23:13:09] WARNING[2827]: chan_dahdi.c:3371 alloc_sub: Callwait subchannel of 120 already in use
[Jul 15 23:13:09] ERROR[2827]: sig_analog.c:595 analog_request: Unable to alloc subchannel
[Jul 15 23:13:09] WARNING[2827]: app_dial.c:1884 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 17 - User busy)
 == Everyone is busy/congested at this time (1:1/0/0)
   -- Auto fallthrough, channel 'DAHDI/38-1' status is 'BUSY'
   -- DAHDI/120-1 answered DAHDI/31-1
   -- Native bridging DAHDI/31-1 and DAHDI/120-1
   -- Channel 0/14, span 2 got hangup request, cause 16
   -- Hungup 'DAHDI/38-1'
   -- Accepting call from '9785699999' to '0000' on channel 0/21, span 2
   -- Executing Wait("DAHDI/45-1", "2")
   -- Executing NoOp("DAHDI/45-1", "Setting CallerID")
   -- Executing Set("DAHDI/45-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/45-1", "DAHDI/G25,,")
   -- Called G25
   -- DAHDI/119-1 is ringing
   -- DAHDI/119-1 is ringing
pbx2*CLI>
JABBER: Keep alive packet
   -- DAHDI/119-1 answered DAHDI/45-1
   -- Native bridging DAHDI/45-1 and DAHDI/119-1
   -- Channel 0/21, span 2 got hangup request, cause 16
   -- Hanging up on 'DAHDI/119-1'
   -- Hungup 'DAHDI/119-1'
 == Spawn extension (pbx2_pri2_in, 0000, 4) exited non-zero on 'DAHDI/45-1'
   -- Hungup 'DAHDI/45-1'
   -- Accepting call from '9785699999' to '0000' on channel 0/12, span 2
   -- Executing Wait("DAHDI/36-1", "2")
   -- Executing NoOp("DAHDI/36-1", "Setting CallerID")
   -- Executing Set("DAHDI/36-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/36-1", "DAHDI/G25,,")
   -- Called G25
   -- DAHDI/119-1 is ringing
   -- DAHDI/119-1 is ringing
   -- Channel 0/12, span 2 got hangup request, cause 16
   -- Hanging up on 'DAHDI/119-1'
   -- Hungup 'DAHDI/119-1'
 == Spawn extension (pbx2_pri2_in, 0000, 4) exited non-zero on 'DAHDI/36-1'
   -- Hungup 'DAHDI/36-1'
   -- Accepting call from '9785699999' to '0000' on channel 0/11, span 2
   -- Executing Wait("DAHDI/35-1", "2")
   -- Executing NoOp("DAHDI/35-1", "Setting CallerID")
   -- Executing Set("DAHDI/35-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/35-1", "DAHDI/G25,,")
   -- Called G25
   -- DAHDI/119-1 is ringing
   -- DAHDI/119-1 is ringing
   -- DAHDI/119-1 answered DAHDI/35-1
   -- Native bridging DAHDI/35-1 and DAHDI/119-1
   -- Channel 0/7, span 2 got hangup request, cause 16
pbx2*CLI>
Disconnected from Asterisk server
/usr/sbin/safe_asterisk: line 117:  2771 Segmentation fault      (core dumped) nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY} </dev/${TTY}
Asterisk ended with exit status 139
Asterisk exited on signal 11.



By: Jeff Peeler (jpeeler) 2009-07-16 14:42:42

Try the new cur2.patch please

By: Michael L. Young (elguero) 2009-07-16 22:09:18

The good news is that with the latest patch it appears to have fixed the segfault.

The bad news is that I have callwaiting turned off in chan_dahdi.conf and it is trying to send the call to the channel that is in use.  I even have callwaitingcallerid turned off as well and it is trying to send call waiting caller id.

Perhaps this should go under another bug report but I have noticed that when I send a call from a PRI line out to another machine over PRI, I am getting the following notice:  

[Jul 16 23:03:59] WARNING[22538]: sig_pri.c:1914 sig_pri_call: Unrecognized pridialplan NPI modifier: g

Complete call log:

Accepting call from '9785699999' to '0000' on channel 0/1, span 2
   -- Executing Wait("DAHDI/25-1", "2")
   -- Executing NoOp("DAHDI/25-1", "Setting CallerID")
   -- Executing Set("DAHDI/25-1", "CALLERID(all)="PRI4 Incoming" <(617) 999-9999>")
   -- Executing Dial("DAHDI/25-1", "DAHDI/g4,,")
   -- Requested transfer capability: 0x00 - SPEECH
[Jul 16 23:03:59] WARNING[22538]: sig_pri.c:1914 sig_pri_call: Unrecognized pridialplan NPI modifier: g
   -- Called g4
   -- DAHDI/49-1 is proceeding passing it to DAHDI/25-1
   -- DAHDI/49-1 is ringing
   -- DAHDI/49-1 answered DAHDI/25-1
   -- Native bridging DAHDI/25-1 and DAHDI/49-1
   -- Channel 0/1, span 2 got hangup request, cause 16
   -- Hungup 'DAHDI/49-1'
 == Spawn extension (pbx2_pri2_in, 0000, 4) exited non-zero on 'DAHDI/25-1'
   -- Hungup 'DAHDI/25-1'



By: Jeff Peeler (jpeeler) 2009-07-17 12:02:19

Both of the new issues reported should be in separate bug reports. I went ahead and fixed the callwaiting and callwaitingcallerid options not being respected though as well.

By: Digium Subversion (svnbot) 2009-07-17 12:02:45

Repository: asterisk
Revision: 206998

U   trunk/channels/chan_dahdi.c
U   trunk/channels/sig_analog.c

------------------------------------------------------------------------
r206998 | jpeeler | 2009-07-17 12:02:45 -0500 (Fri, 17 Jul 2009) | 14 lines

Fix segfault in sig_analog when using callwaiting, respect callwaiting options

Sig_analog handles allocating the sub channel for callwaiting, so no longer try
to do it in chan_dahdi. Modified analog_alloc_sub to only mark the sub as
allocated upon success of the alloc_sub callback, which was responsible for the
segfault. Also, the callwaiting and callwaitingcallerid options were being
unconditionally set to true. Now, the options are properly set from
chan_dahdi.conf.

(closes issue ASTERISK-14472)
Reported by: elguero
Tested by: elguero


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

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

By: Digium Subversion (svnbot) 2009-07-17 12:03:37

Repository: asterisk
Revision: 206999

_U  branches/1.6.0/

------------------------------------------------------------------------
r206999 | jpeeler | 2009-07-17 12:03:37 -0500 (Fri, 17 Jul 2009) | 19 lines

Blocked revisions 206998 via svnmerge

........
 r206998 | jpeeler | 2009-07-17 12:02:44 -0500 (Fri, 17 Jul 2009) | 14 lines
 
 Fix segfault in sig_analog when using callwaiting, respect callwaiting options
 
 Sig_analog handles allocating the sub channel for callwaiting, so no longer try
 to do it in chan_dahdi. Modified analog_alloc_sub to only mark the sub as
 allocated upon success of the alloc_sub callback, which was responsible for the
 segfault. Also, the callwaiting and callwaitingcallerid options were being
 unconditionally set to true. Now, the options are properly set from
 chan_dahdi.conf.
 
 (closes issue ASTERISK-14472)
 Reported by: elguero
 Tested by: elguero
........

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

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

By: Digium Subversion (svnbot) 2009-07-17 12:04:00

Repository: asterisk
Revision: 207000

_U  branches/1.6.1/

------------------------------------------------------------------------
r207000 | jpeeler | 2009-07-17 12:04:00 -0500 (Fri, 17 Jul 2009) | 19 lines

Blocked revisions 206998 via svnmerge

........
 r206998 | jpeeler | 2009-07-17 12:02:44 -0500 (Fri, 17 Jul 2009) | 14 lines
 
 Fix segfault in sig_analog when using callwaiting, respect callwaiting options
 
 Sig_analog handles allocating the sub channel for callwaiting, so no longer try
 to do it in chan_dahdi. Modified analog_alloc_sub to only mark the sub as
 allocated upon success of the alloc_sub callback, which was responsible for the
 segfault. Also, the callwaiting and callwaitingcallerid options were being
 unconditionally set to true. Now, the options are properly set from
 chan_dahdi.conf.
 
 (closes issue ASTERISK-14472)
 Reported by: elguero
 Tested by: elguero
........

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

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

By: Digium Subversion (svnbot) 2009-07-17 12:04:35

Repository: asterisk
Revision: 207001

_U  branches/1.6.2/

------------------------------------------------------------------------
r207001 | jpeeler | 2009-07-17 12:04:35 -0500 (Fri, 17 Jul 2009) | 19 lines

Blocked revisions 206998 via svnmerge

........
 r206998 | jpeeler | 2009-07-17 12:02:44 -0500 (Fri, 17 Jul 2009) | 14 lines
 
 Fix segfault in sig_analog when using callwaiting, respect callwaiting options
 
 Sig_analog handles allocating the sub channel for callwaiting, so no longer try
 to do it in chan_dahdi. Modified analog_alloc_sub to only mark the sub as
 allocated upon success of the alloc_sub callback, which was responsible for the
 segfault. Also, the callwaiting and callwaitingcallerid options were being
 unconditionally set to true. Now, the options are properly set from
 chan_dahdi.conf.
 
 (closes issue ASTERISK-14472)
 Reported by: elguero
 Tested by: elguero
........

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

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