[Home]

Summary:ASTERISK-13252: Asterisk crashes when calling more than a single location
Reporter:Leif Madsen (lmadsen)Labels:
Date Opened:2008-12-19 14:36:01.000-0600Date Closed:2009-02-12 00:36:33.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Applications/app_dial
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 14118.patch
( 1) 14118v2.patch
( 2) asterisk_multi_location_dial_crash.txt
( 3) valgrind.txt
( 4) valgrind2.txt
Description:By doing something like the following, Asterisk crashes for me:

Dial(SIP/leifmadsen_desk&SIP/leifmadsen_laptop&SIP/leifmadsen_cell,30,o)
Comments:By: Mark Michelson (mmichelson) 2008-12-19 14:42:26.000-0600

Let's first try the obvious possible causes.

what is s->owner and if that's not NULL, then what is s->owner->name?

By: Leif Madsen (lmadsen) 2008-12-19 14:44:00.000-0600

(gdb) p s->owner
$1 = (struct ast_channel *) 0x61633961312d3439
(gdb) p s->owner->name
Cannot access memory at address 0x61633961312d34f9

By: Leif Madsen (lmadsen) 2008-12-19 15:01:33.000-0600

[ivr]
exten => s,1,Verbose(1,Handling call in IVR from ${CALLERID(all)})
exten => s,n,Set(CALLERID(name)=LME:${CALLERID(name)})
exten => s,n,GoSub(setup_timeouts,s,1)
exten => s,n,Answer()
exten => s,n,Set(LOOP_SUPPRESSOR=1)
exten => s,n(start),Background(silence/1&custom/ivr_main)
exten => s,n,WaitExten()

exten => s,n,Verbose(1, No digits pressed... sending to operator)
exten => s,n,GoSub(sub-phones,s,1(100&101&61)
exten => s,n,Hangup()

exten => i,1,NoOp()
exten => i,n,Set(LOOP_SUPPRESSOR=$[${LOOP_SUPPRESSOR} + 1])
exten => i,n,ExecIf($[${LOOP_SUPPRESSOR} > 3]?NoOp():Playback(invalid))
exten => i,n,ExecIf($[${LOOP_SUPPRESSOR} > 3]?Playback(pls-wait-connect-call):NoOp())
exten => i,n,GoSubIf($[${LOOP_SUPPRESSOR} > 3]?sub-phones,s,1(100&101&61))
exten => i,n,Goto(s,start)


exten => 1,1,GoSub(sub-phones,s,1(100&101&61))
exten => 1,n,Hangup()



[setup_timeouts]
exten => s,1,NoOp()
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=12)
exten => s,n,Return()




;-- GoSub for handling internal calls --;
[sub-phones]
; ARG1: Extension numbers to dial separated by ampersands (&)
exten => s,1,NoOp()
exten => s,n,Set(EXT=${ARG1})
exten => s,n,GotoIf($[${ISNULL(${ARG1})}]?error)
exten => s,n,Set(PRIMARY_EXT=${CUT(EXT,&,1)})
exten => s,n,Set(PBX=${DB(system/pbx)})
exten => s,n,Set(X=1)

exten => s,n,While($[${EXISTS(${CUT(EXT,&,${X})})}])
exten => s,n,Set(CURR_EXT=${CUT(EXT,&,${X})})
exten => s,n,Set(USERNAME=${DB(phones/${CURR_EXT}/username)})
exten => s,n,Set(TECH=${DB(phones/${CURR_EXT}/tech)})
exten => s,n,GotoIf($[${ISNULL(${USERNAME})} | ${ISNULL(${TECH})}]?next)
exten => s,n,Set(DIALSTRING=${IF($[${ISNULL(${DIALSTRING})}]?${TECH}/${USERNAME}:${DIALSTRING}&${TECH}/${USERNAME})})
exten => s,n(next),NoOp()
exten => s,n,Set(X=$[${X} + 1])
exten => s,n,EndWhile()

exten => s,n,GotoIf($[${EXISTS(${DIALSTRING})}]?dial)
exten => s,n(error),Playback(an-error-has-occured)
exten => s,n,Return()

exten => s,n(dial),NoOp()
exten => s,n,Dial(${DIALSTRING},${G_DEFAULT_RING_CYCLE},o)
exten => s,n,GotoIf($["${CUT(DIALSTRING,/,3)}" = "6474483075"]?vm)
exten => s,n,Read(RESPONSE,custom/press-1-locate-2-vm,1)
exten => s,n,GotoIf($[${ISNULL(${RESPONSE})} | "${RESPONSE}" = "2"]?vm)
exten => s,n,Playback(pls-wait-connect-call)
exten => s,n,Dial(SIP/4164790259/6474483075,26,o)
exten => s,n(vm),Voicemail(${PRIMARY_EXT}@${PBX},${IF($["${DIALSTATUS}" = "BUSY"]?b:u)})
exten => s,n,Hangup()

By: Mark Michelson (mmichelson) 2008-12-19 15:13:00.000-0600

I've uploaded a patch, 14118.patch, which will at the least make valgrind shut up about the uninitialized value usages in func_timeout. I'm not sure if this will fix the crash or not.

By: Mark Michelson (mmichelson) 2008-12-19 16:12:17.000-0600

New patch uploaded which should address the problems seen in valgrind2.txt

By: Leif Madsen (lmadsen) 2008-12-20 08:29:56.000-0600

That fixed it!

By: Leif Madsen (lmadsen) 2008-12-20 08:30:17.000-0600

btw: can you explain what the issue was? That was I might be able to decide if I should roll another 1.6.1-beta.

Thanks!

By: Mark Michelson (mmichelson) 2008-12-20 16:09:02.000-0600

The issue was a refcount issue that apparently was only present when playing back a file with internal timing enabled. The problem was most likely due to an insufficient merge from a 1.4 fix.

By: Digium Subversion (svnbot) 2008-12-22 10:07:55.000-0600

Repository: asterisk
Revision: 166267

U   trunk/funcs/func_timeout.c
U   trunk/main/file.c

------------------------------------------------------------------------
r166267 | mmichelson | 2008-12-22 10:07:55 -0600 (Mon, 22 Dec 2008) | 17 lines

Fix a file playback crash and explicitly initialize values in func_timeout.c

A crash was brought up on the bugtracker. The first run through valgrind
was full of legitimate complaints of uninitialized values in func_timeout when
setting a response timeout. These were fixed but the crash persisted.

A second run through showed the real problem. The reference counting used
for filestreams was incorrect because there were some missing increments
when a frame was read from a format module.

(closes issue ASTERISK-13252)
Reported by: blitzrage
Patches:
     14118v2.patch uploaded by putnopvut (license 60)
Tested by: blitzrage


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

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

By: Digium Subversion (svnbot) 2008-12-22 10:10:09.000-0600

Repository: asterisk
Revision: 166271

_U  branches/1.6.0/
U   branches/1.6.0/main/file.c

------------------------------------------------------------------------
r166271 | mmichelson | 2008-12-22 10:10:09 -0600 (Mon, 22 Dec 2008) | 25 lines

Merged revisions 166267 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r166267 | mmichelson | 2008-12-22 10:07:59 -0600 (Mon, 22 Dec 2008) | 17 lines

Fix a file playback crash and explicitly initialize values in func_timeout.c

A crash was brought up on the bugtracker. The first run through valgrind
was full of legitimate complaints of uninitialized values in func_timeout when
setting a response timeout. These were fixed but the crash persisted.

A second run through showed the real problem. The reference counting used
for filestreams was incorrect because there were some missing increments
when a frame was read from a format module.

(closes issue ASTERISK-13252)
Reported by: blitzrage
Patches:
     14118v2.patch uploaded by putnopvut (license 60)
Tested by: blitzrage


........

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

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

By: Digium Subversion (svnbot) 2008-12-22 10:17:12.000-0600

Repository: asterisk
Revision: 166275

_U  branches/1.6.1/
U   branches/1.6.1/funcs/func_timeout.c
U   branches/1.6.1/main/file.c

------------------------------------------------------------------------
r166275 | mmichelson | 2008-12-22 10:17:12 -0600 (Mon, 22 Dec 2008) | 25 lines

Merged revisions 166267 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r166267 | mmichelson | 2008-12-22 10:07:59 -0600 (Mon, 22 Dec 2008) | 17 lines

Fix a file playback crash and explicitly initialize values in func_timeout.c

A crash was brought up on the bugtracker. The first run through valgrind
was full of legitimate complaints of uninitialized values in func_timeout when
setting a response timeout. These were fixed but the crash persisted.

A second run through showed the real problem. The reference counting used
for filestreams was incorrect because there were some missing increments
when a frame was read from a format module.

(closes issue ASTERISK-13252)
Reported by: blitzrage
Patches:
     14118v2.patch uploaded by putnopvut (license 60)
Tested by: blitzrage


........

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

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

By: Digium Subversion (svnbot) 2008-12-22 10:30:21.000-0600

Repository: asterisk
Revision: 166278

U   branches/1.6.0/include/asterisk/file.h
U   branches/1.6.0/include/asterisk/frame.h
U   branches/1.6.0/main/file.c
U   branches/1.6.0/main/frame.c

------------------------------------------------------------------------
r166278 | mmichelson | 2008-12-22 10:30:21 -0600 (Mon, 22 Dec 2008) | 8 lines

When merging the fix for issue ASTERISK-13252, I found that
the issue didn't affect 1.6.0, but in this case that's
not an especially good thing, because it means that
the fix for issue ASTERISK-12741 was not merged into 1.6.0 in
the first place. This commit kills two birds with one
stone by putting both fixes in the 1.6.0 branch


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

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