Summary:ASTERISK-11250: chanspy - crashes Asterisk
Reporter:Marcin Kowalczyk (kowalma)Labels:
Date Opened:2008-01-17 04:12:58.000-0600Date Closed:2008-06-04 10:08:52
Versions:Frequency of
Environment:Attachments:( 0) bt-full.txt
( 1) r109226-chanspy.txt
( 2) r109226-chanspy-siponly.txt
( 3) r109226-chanspy-siponly+mixmonitor.txt
( 4) typescript.txt
Description:duplicated bug from: 0011770 and 11654

Issue 11654 have been closed with comment:

"Fixed in 1.4 as of revision 98975."

but svn reports no revison 98975.

 svn co -r 98975 http://svn.digium.com/svn/asterisk/branches/1.4 asterisk-fixed
 svn: REPORT request failed on '/svn/asterisk/!svn/bc/98956/branches/1.4'
 svn: No such revision 98975

I've updated to most recent version from:

svn co http://svn.digium.com/svn/asterisk/branches/1.4 asterisk-svn/

Asterisk SVN-branch-1.4-r97889

and it still crashes. I can't reopen issue 11654 so I create new one.

Comments:By: Marcin Kowalczyk (kowalma) 2008-01-17 05:12:52.000-0600

I've just got idea when Asterisk crashes. Channels which are not recodred I can listen for 1h and nothing happens. When I start to spy recorded channels asterisk crashes in 2-3 minutes.

I spied agent is on ZAP channel and call is between ZAP channels. Spying is thought SIP/IAX channel.

When ZAP agents disconnects I stay spying and waiting for call for specific extension. I've tried spying with extenspy and chanspy and both causes Asterisk to  Crash.

By: Marcin Kowalczyk (kowalma) 2008-01-17 07:21:56.000-0600

Tested again - chanspy crashes asterisk when I spy group which is empty - few seconds is ok, then crash. To spy particular callerID I create spygroup in dialout macro:

 exten => s,1,Set(SPYGROUP=${CALLERID(num)})

Extension for spying channel:

exten => _62XXX,n,ChanSpy(|qv(0)g(${EXTEN:2}))
exten => _63XXX,n,ExtenSpy(|qv(0)g(${EXTEN:2}))

Doesn't matter if channel is recorded or not.

By: Joshua C. Colp (jcolp) 2008-01-17 08:17:15.000-0600

The mirror was resyncing so the revision was not available, you are still using the old code. If you update now it should be available. Retry and report back.

By: Marcin Kowalczyk (kowalma) 2008-01-17 08:21:40.000-0600


svn co -r 98975 http://svn.digium.com/svn/asterisk/branches/1.4 asterisk-fixed
svn: request REPORT failed '/svn/asterisk/!svn/bc/98956/branches/1.4'
svn: No such revision 98975

host svn.digium.com
svn.digium.com has address

By: Joshua C. Colp (jcolp) 2008-01-17 10:27:15.000-0600

I've now confirmed it is synced, give it a go.

By: Marcin Kowalczyk (kowalma) 2008-01-17 11:04:10.000-0600

I've downloaded revison 98975 but rasterisk reports: SVN-branch-1.4-r98973 I think rasterisk should report also 98975

I'll check behalf of this revison of asterisk.

By: Marcin Kowalczyk (kowalma) 2008-01-17 11:33:19.000-0600

After 10 minutes of spying Asterisk has crashed :|

By: Joshua C. Colp (jcolp) 2008-01-17 11:35:09.000-0600

Then please attach a backtrace and console output following the instructions of backtrace.txt in the doc directory.

By: Marcin Kowalczyk (kowalma) 2008-01-17 12:58:17.000-0600

Backtrace after last crash (asterisk compiled with option DONT_OPTIMIZE) is in file typescript.txt

Console just says disconected, full.log says nothing

Asterisk revison 98975 but rasterisk reports: Asterisk SVN-branch-1.4-r98973 - is it ok?

My previous core files are from asterisk compiled without DONT_OPTIMIZE should I put them here?

By: Andrew Lindh (andrew) 2008-01-17 19:44:41.000-0600

I've had ChanSpy crash my main PBX running with current branch 1.4 too.... Then I ran it on my test system and it did not crash.... I'll have to try some more this weekend.

By: Joshua C. Colp (jcolp) 2008-01-18 11:51:24.000-0600

Please type the following in gdb with the core file open and attach the results:

frame 0
print *c

As well did you hang up at that point when it crashed?

By: Marcin Kowalczyk (kowalma) 2008-01-18 11:58:41.000-0600

(gdb) frame 0
#0  0x080803ed in ast_waitfor_nandfds (c=0xb6b5c190, n=1, fds=0xb6b5c19c, nfds=0, exception=0x0, outfd=0xb6b5c168, ms=0xb6b5c194) at channel.c:1636
1636                    ast_channel_lock(c[x]);
(gdb) print *c
$1 = (struct ast_channel *) 0x8340a48
(gdb) quit

When asterisk crashed all calls have been terminated. sip call stayed active Grandstream GXP2000 didn't hangup, but core show channels indicated no active sip channels

By: Joshua C. Colp (jcolp) 2008-01-18 12:01:33.000-0600

So it was just sitting there waiting for you to hit some DTMF keys and crashed?

By: Marcin Kowalczyk (kowalma) 2008-01-18 12:09:53.000-0600

I was sitting and listeting for calls from callerID 252. And suddenly asterisk crashed - no DTMF tone were send by me.

Like I said - I spy particular caller ID by setting spygroup in dialplan (there is no other way to spy particular agent), when there is no active call from spied CID spygroup is empty.
I have incoming traffic from Siemens PBX, asterisk is used for recording and LCR (outgoing  through E1 or IAX).

By: Marcin Kowalczyk (kowalma) 2008-01-22 02:07:27.000-0600

Today I've tried  Asterisk SVN-branch-1.4-r99341 but also crashes while spying channel. Maybe I should try 1.6beta ?

By: FACORAT Fabrice (dark_schneider971) 2008-01-22 07:25:23.000-0600

opened also in bug ASTERISK-11116

By: Andrew Lindh (andrew) 2008-01-22 17:30:58.000-0600

Still crashes... SVN-branch-1.4-r99652M

Compled with DONT_OPTIMIZE.

Core was generated by `/usr/sbin/asterisk -vvvg -c'.
Program terminated with signal 11, Segmentation fault.
#0  0x080ee6f3 in ast_slinfactory_read (sf=0xb6bd3990, buf=0xb6bd28c0,
   samples=160) at slinfactory.c:140
140 memcpy(sf->hold, frame_data, remain * sizeof(*offset));

#0  0x080ee6f3 in ast_slinfactory_read (sf=0xb6bd3990, buf=0xb6bd28c0,
   samples=160) at slinfactory.c:140
#1  0x08072af7 in audiohook_read_frame_both (audiohook=0xb6bd2f1c, samples=160)
   at audiohook.c:213
#2  0x08072d81 in ast_audiohook_read_frame (audiohook=0xb6bd2f1c, samples=160,
   direction=AST_AUDIOHOOK_DIRECTION_BOTH, format=64) at audiohook.c:260
#3  0xb72b2686 in spy_generate (chan=0x82f33f0, data=0xb6bd2f1c, len=0,
   samples=160) at app_chanspy.c:174
#4  0x08080cae in generator_force (data=0x82f33f0) at channel.c:1563
ASTERISK-1  0x080821b6 in __ast_read (chan=0x82f33f0, dropaudio=0) at channel.c:1979
ASTERISK-2  0x080838d8 in ast_read (chan=0x82f33f0) at channel.c:2295
ASTERISK-3  0xb72b2ac7 in channel_spy (chan=0x0, spyee=0x0, volfactor=0x0, fd=0,
   flags=0x0) at app_chanspy.c:275
ASTERISK-4  0x00000000 in ?? ()

Asterisk freshly compiled and installed.
All calls using G.711 ulaw.
One SIP extension is running chanspy.
No other calls active.
One SIP call comes in (it's from a cisco AS5300 gateway)
The call is answered as it was to the main number.
The system runs an AGI to process CID and does a few other things.
Auto Attendant starts playing (office hours etc, using Background for playback)
The AA message continues to the next step (using Background playback again)
And then just as the next message should start playing, Asterisk crashes.
No error messages on the console.
No DTMF keys were dialed at any time.

Asterisk on the same system does not crash when NOT using chanspy.

Full backtrace attached uploaded (bt-full.txt)

By: Marcin Kowalczyk (kowalma) 2008-02-14 01:49:21.000-0600

1.4.18 doesn't fix a problem.

By: destiny6628 (destiny6628) 2008-02-19 04:01:52.000-0600

still chan spy has a problem in asterisk-1.4.18 as well .

As soon as any one starts spying a call asterisk gets crashed .

By: destiny6628 (destiny6628) 2008-02-19 04:02:35.000-0600

still chan spy has a problem in asterisk-1.4.18 as well .

As soon as any one starts spying a call asterisk gets crashed .

By: JonBFS (bfsworks) 2008-03-05 17:52:03.000-0600

Confirming same issue. Monitored ChanSpy / Monitor issue fixed in 1.4.18 hoping it would also fix our ChanSpy issue using SPYGROUPs. As of 1.4.18 a fix for this still not found.


By: Joshua C. Colp (jcolp) 2008-03-12 16:29:07

There was an issue that was just fixed today specifically to do with app_chanspy, if that still doesn't work I would strongly like access to a box where a core dump is so I can examine it.

By: Russell Bryant (russell) 2008-03-14 16:06:55

I'm feeling very confident that we have chanspy rid of crashes for now.  Please reopen if you still have problems, though.

By: Marcin Kowalczyk (kowalma) 2008-03-17 08:23:26

Unfortunately, Asterisk 1.4r108796 just crashed during spying.

It is possible to get access to machine.

By: Marcin Kowalczyk (kowalma) 2008-03-18 14:51:18

1.4.19rc2 - also crashes asterisk AND can not spy channel. Even chanspy(scan) transmits no sound.

By: Ashley Winters (awinters) 2008-03-18 15:08:23

I tried running the 1.4 branch r109226, and while it didn't segfault, it instead looped endlessly with the deadlock avoidance warning after running ChanSpy. I'll attach a log

By: Joshua C. Colp (jcolp) 2008-03-18 15:22:31

awinters: I don't understand your setup... it appears you are using Local channels, can you elaborate on call flow?

By: Ashley Winters (awinters) 2008-03-18 15:34:56

The Local channel is due to initiating the spy using the manager api.

Action: Originate
Channel: Local/$number@call-voip
Context: monitor
Variable: MONITOR=$id

exten => 1,1,Chanspy(|qbg(${MONITOR}))

By: Joshua C. Colp (jcolp) 2008-03-18 15:55:55

So to narrow this down a bit, what happens if you add /n to the end of your Local dial string?

By: Ashley Winters (awinters) 2008-03-18 17:12:36

So as to simplify my test, I've changed all the channels involved to SIP, and made a clean test case

1. AMI-Originate a call to my VoIP phone via SIP
2. Dial() another phone via SIP, via the AMI Context  -- [insanity] context
3. AMI-Originate a spy call to another VoIP phone via SIP
4. ChanSpy() on the first call, via the AMI Context  -- [spy] context

Attached r109226-chanspy-siponly.txt log containing the full call sequence decribed above.

Local/ and Local//n do seem to behave slightly differently re: debug messages, but both are broken, and if SIP gets fixed and Local stays broken, I'll revisit it then.

By: Ashley Winters (awinters) 2008-03-18 17:33:07

Also added an unfortunately large trace of the clean debug that includes a MixMonitor() as well, since my initial trace was recording at the same time as running ChanSpy()

By: JonBFS (bfsworks) 2008-03-19 14:49:53

Any resolve yet. I almost complied for our production system. Thanks.

By: Ashley Winters (awinters) 2008-04-08 13:14:34

Is there any more information I can provide that would help?

By: Joshua C. Colp (jcolp) 2008-05-20 14:16:59

I *think* I know what the reason is... but need to see *complete* console output from start to finish.

By: Fernando Berretta (fberretta) 2008-05-22 22:38:43

My Asterisk 1.4.18-3 installation had crashed

#0  0x00e3dfd3 in strlen () from /lib/libc.so.6
No symbol table info available.
#1  0x023778b9 in ?? () from /usr/lib/asterisk/modules/app_chanspy.so
No symbol table info available.
#2  0x023781b5 in ?? () from /usr/lib/asterisk/modules/app_chanspy.so
No symbol table info available.
#3  0x02378eca in ?? () from /usr/lib/asterisk/modules/app_chanspy.so
No symbol table info available.
#4  0x080cbd54 in ast_add_extension2 ()
No symbol table info available.
ASTERISK-1  0x080ce4dc in ast_async_goto_by_name ()
No symbol table info available.
ASTERISK-2  0x080cf58e in ast_pbx_run ()
No symbol table info available.
ASTERISK-3  0x080ffa5a in ast_tvnow ()
No symbol table info available.
ASTERISK-4  0x0080945b in start_thread () from /lib/libpthread.so.0
No symbol table info available.
ASTERISK-5  0x00e9f24e in clone () from /lib/libc.so.6
No symbol table info available.

Is there some fix ?

By: Joshua C. Colp (jcolp) 2008-05-27 08:50:34

fberretta: Please file another issue with complete information, without optimizations, and with a complete backtrace.

By: Russell Bryant (russell) 2008-06-03 15:14:06

Please try the latest code in the 1.4 branch, as this issue may already be fixed as of revision 118365.

By: Fernando Berretta (fberretta) 2008-06-03 15:41:32

Russell, thanks for the your help and recommendation, probably you're right I will try it in future installations and will report if the problem is still there. The problem is the system is in a production environment and installed from TrixBox 2.4.2 and the server is a hundred kilometers from me so is too risky and I can't try it on  this server.

By: Russell Bryant (russell) 2008-06-04 10:08:48

I'm going to close this out and assume it is fixed, then.  Please open a new bug report if you still experience a problem with 1.4.21 or above.