Summary:ASTERISK-16174: Segfault after launching JACK_HOOK from AMI
Reporter:Motiejus Jakstys (motiejus)Labels:
Date Opened:2010-05-31 06:52:45Date Closed:2010-08-26 10:47:16
Versions:Frequency of
Environment:Attachments:( 0) gdb.txt
Description:Setting JACK_HOOK channel variable from AMI leads to asterisk segfault.
However, setting JACK_HOOK from command line works OK:
When the call is started:
*CLI> dialplan set chanvar $stuff{Channel} JACK_HOOK(manipulate,n,i(rec_$uniq:input),o(rec_$uniq:output),c(rec_$uniq)) on

works, but the same in AMI:

Action: Setvar
Channel: $stuff{Channel}
Variable: JACK_HOOK(manipulate,n,i(rec_$uniq:input),o(rec_$uniq:output),c(rec_$uniq))
Value: on

throws segmentation fault for asterisk. Trace of connecting the call:

[New Thread 0x2b9a16c5e910 (LWP 32621)]
   -- Executing [123456@NPDB2:73] Monitor("SIP/1001-00000000", "wav,myfilename") in new stack
   -- Executing [123456@NPDB2:74] Set("SIP/1001-00000000", "DialTo=PBX2") in new stack
   -- Executing [123456@NPDB2:75] NoOp("SIP/1001-00000000", "PBX2") in new stack
   -- Executing [123456@NPDB2:76] NoOp("SIP/1001-00000000", "SIP/1001-00000000") in new stack
   -- Executing [123456@NPDB2:77] Dial("SIP/1001-00000000", "SIP/PBX2/000123456,60,M(connect-jack,741586)") in new stack
 == Using SIP RTP CoS mark 5
   -- Called PBX2/000123456
 == Begin MixMonitor Recording SIP/1001-00000000
   -- SIP/PBX2-00000001 is ringing
[New Thread 0x2b9a1745f910 (LWP 32742)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2b9a16aea910 (LWP 32607)]
0x00002b9a07d4718a in jack_activate (client=0xca23d0) at client.c:1985
1985 buf[i] = (char) (i & 0xff);

It is not a problem if Jack (I suppose), because same from Dialplan and asterisk CLI works fine.


Asterisk, jackd 0.118.0, debian 5.04
pbx2_test:/# uname -a
Linux pbx2_test #2 SMP Thu Apr 29 15:55:34 EEST 2010 x86_64 GNU/Linux

Used exactly this file for automatic AMI variable setting:

How to reproduce: download asterisk_ami.pl, modify header for AMI logins, launch the script without parameters, open Jack server and make a call. This should crash asterisk.
Comments:By: Paul Belanger (pabelanger) 2010-05-31 12:04:01

Please upload a complete backtrace.
Thank you for your bug report. In order to move your issue forward, we require a backtrace from the core file produced after the crash. Please see the doc/backtrace.txt file in your Asterisk source directory.

Also, be sure you have DONT_OPTIMIZE enabled in menuselect within the Compiler Flags section, then:

make install

after enabling, reproduce the crash, and then execute the instructions in doc/backtrace.txt.

When complete, attach that file to this issue report. Thanks!

By: Motiejus Jakstys (motiejus) 2010-06-01 02:00:48

Uploaded gdb.txt: bt, bt full and thread apply all bt.

By: Russell Bryant (russell) 2010-08-10 16:07:56

I just tried to reproduce this (using my own script that uses AMI SetVar), and was unable to make it crash.  Could you try running Asterisk under valgrind and see if you can get some better debug output?  See doc/valgrind.txt for some more information on that.  Also, make sure you try the latest version of Asterisk.

By: Leif Madsen (lmadsen) 2010-08-23 17:48:02

Information required from the reporter to move this issue forward.

By: Russell Bryant (russell) 2010-08-26 10:47:16

Thank you for the bug report. However I am unable to reproduce this issue. We are now going to close this report - please feel free to reopen when you have more information at hand.