[Home]

Summary:ASTERISK-17635: [patch] asterisk crashes on unattended transfer
Reporter:jamhed (jamhed)Labels:
Date Opened:2011-04-02 17:39:46Date Closed:2011-05-06 10:18:49
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:PBX/pbx_lua
Versions:1.6.2.17 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bt.txt
( 1) bt-sip-refer.txt
( 2) bt-sip-refer-2.txt
( 3) debug.log
( 4) debug-sip-refer.log
( 5) debug-sip-refer-2.log
( 6) lua_datastore_fixup-1.6.2-1.diff
( 7) lua_datastore_fixup1.diff
Description:A,B,C are sip peers.

A calls B, then A do a blind transfer (dtmf sequence or sip refer) to C,
and then asterisk (1.6.2.17) dumps core.

If B do a blind transfer then it works.
If A do an attended transfer then it works.

If I replace the context for sip peers to use pbx_config switch,
it works. Here is how it looks:

[ncom]
exten => _24XX,1,DIAL(SIP/${EXTEN},30,tT)
exten => _24XX,n,Hangup

It seems to me that the problem is related to ast_async_goto() because
I see "AsyncGoto/SIP/2401-0000000d<ZOMBIE>" in app.log() while trying to do a transfer.
Also I've noticed that even that "AsyncGoto" strings disappears in app.log() output if
I do a one second sleep and then continue execution of lua script.

But when I use pbx_config switch, then it shows a proper channel name
like SIP/2401-00000003, without these AsyncGoto and ZOMBIE.

I think there should be a difference between pbx_config and pbx_lua behaviour,
but I cannot figure out what it is and where to look for.

I guess that lua script somehow executed on a wrong (dying) channel.

Here is my extensions.lua for this case, it's quite simple:

function simple_switch(ctx, number)
  app.log("VERBOSE", "simple switch: " .. number)
  app.dial("SIP/" .. number, 30, "tT")
end

extensions["ncomlua"] = {
  ["_."] = simple_switch
}
Comments:By: Matthew Nicholson (mnicholson) 2011-04-05 15:38:23

I think I know what the problem may be.  Please upload a backtrace.

By: jamhed (jamhed) 2011-04-05 16:32:29

I uploaded gdb's 'thread apply all bt' output, and asterisk's output.

This core I managed to get with dtmf unattended transfer (A dials B, B answers, A dials dtmf sequence, hear "transfer" and then dials C, coredump)

And lua's dialplan for this is:

function simple_switch(ctx, number)
  app.log("VERBOSE", "simple switch: " .. number)
  os.execute("sleep 1")
  app.log("VERBOSE", "simple switch: " .. number)
  app.dial("SIP/" .. number, 10, "tT")
end

extensions["ncomlua"] = {
  ["_."] = simple_switch
}

By: jamhed (jamhed) 2011-04-05 16:46:30

Also I was unable to do a core dump with sip refer transfer (A dials B, B answers, A does a SIP REFER to C, call goes as directed) today, but I swear :) it was there couple of days ago (I didn't save a core though).

By: jamhed (jamhed) 2011-04-05 17:25:01

I've finally managed to make it core dump with sip refer with my production dialplan, please see bt-sip-refer.txt for the backtrace, and debug-sip-refer.log for asterisk's output.

By: jamhed (jamhed) 2011-04-05 17:41:28

I also uploaded couple of another bt and debug.log for sip refer crash, but now it crashes with my production dialplan only (which actually quite complex and do some database i/o), but as far as I can see the problem is related to lua being executed on "AsyncGoto/SIP/2401-0000000e<ZOMBIE>" channel which eventually becomes "(null)".

So I can reproduceable do a core with my test dialplan for dtmf unattended transfer, and do a core for sip refer with my production dialplan.

By: jamhed (jamhed) 2011-04-14 18:03:36

anyone?

By: Matthew Nicholson (mnicholson) 2011-04-15 15:40:41

Try the patch I just posted (lua_datastore_fixup1.diff).

By: Matthew Nicholson (mnicholson) 2011-04-15 15:44:40

The patch I uploaded was for trunk, I just uploaded one for 1.6.2.

By: jamhed (jamhed) 2011-04-18 21:22:54

Thank's a lot. It seems it got fixed. And it also fixed the crashes after use LOCAL channel inside a lua script. I'll do more testing in production meanwhile.

By: Digium Subversion (svnbot) 2011-05-05 17:47:59

Repository: asterisk
Revision: 317476

U   branches/1.8/pbx/pbx_lua.c

------------------------------------------------------------------------
r317476 | russell | 2011-05-05 17:47:58 -0500 (Thu, 05 May 2011) | 8 lines

Add a datastore fixup to fix a pbx_lua crash.

(closes issue ASTERISK-17635)
Reported by: jamhed
Patches:
     lua_datastore_fixup1.diff uploaded by mnicholson (license 96)
Tested by: mnicholson, jamhed

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

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

By: Digium Subversion (svnbot) 2011-05-05 17:49:38

Repository: asterisk
Revision: 317477

_U  trunk/
U   trunk/pbx/pbx_lua.c

------------------------------------------------------------------------
r317477 | russell | 2011-05-05 17:49:38 -0500 (Thu, 05 May 2011) | 15 lines

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

........
 r317476 | russell | 2011-05-05 17:47:57 -0500 (Thu, 05 May 2011) | 8 lines
 
 Add a datastore fixup to fix a pbx_lua crash.
 
 (closes issue ASTERISK-17635)
 Reported by: jamhed
 Patches:
       lua_datastore_fixup1.diff uploaded by mnicholson (license 96)
 Tested by: mnicholson, jamhed
........

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

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

By: Digium Subversion (svnbot) 2011-05-06 10:18:48

Repository: asterisk
Revision: 317666

U   branches/1.6.2/pbx/pbx_lua.c

------------------------------------------------------------------------
r317666 | mnicholson | 2011-05-06 10:18:47 -0500 (Fri, 06 May 2011) | 8 lines

Add a datastore fixup to fix a pbx_lua crash.

(closes issue ASTERISK-17635)
Reported by: jamhed
Patches:
     lua_datastore_fixup1.diff uploaded by mnicholson (license 96)
Tested by: mnicholson, jamhed

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

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