Summary:ASTERISK-19501: Channel group on a Local channel not released after it has been Chanspy'd upon
Reporter:laszlovl (lvl)Labels:
Date Opened:2012-03-08 08:23:03.000-0600Date Closed:2018-01-02 08:30:29.000-0600
Status:Closed/CompleteComponents:Applications/app_chanspy Functions/func_groupcount
Versions:10.5.0 Frequency of
duplicatesASTERISK-19493 ChanSpy onto a Local channel can leave a hung channel
is related toASTERISK-25321 [patch]DeadLock ChanSpy with call over Local channel
Environment:Asterisk trunk checkoutAttachments:
Description:While testing workarounds for ASTERISK-19493, I discovered another bug related to ChanSpy + Local channels. It is very similar to ASTERISK-19386, but the steps mentioned in that bug no longer reproduce the issue. The steps below, however, still do.

Create 3 sip users, 'caller', 'agent' and 'supervisor' and log onto them with a SIP phone.

Create extensions.conf:
exten => caller,1,Queue(queue1)
exten => supervisor,1,ChanSpy(Local/s@phones,qsES)

exten => s,1,Set(GROUP()=agent)
exten => s,n,Dial(SIP/agent)

member => Local/s@phones/n

Then reproduce the issue as follows:
- On the caller phone, dial 'caller' to get into the queue
- On the agent phone, answer the queue call
- On the supervisor phone, dial 'supervisor' to start the ChanSpy
- Hang up the queue call

Around 25% of the times, the bug will manifest: the GROUP on the local channel never gets cleared even though the channel itself h:
NOTICE[31262]: app_chanspy.c:487 start_spying: Attaching SIP/supervisor-00000014 to Local/s@phones-a76e;2
 == Spawn extension (incoming, caller, 1) exited non-zero on 'SIP/caller-00000012'
 == Spawn extension (phones, s, 2) exited non-zero on 'Local/s@phones-a76e;2'
 == Done Spying on channel Local/s@phones-a76e;2
-- Stopped spying due to the spied-on channel hanging up.
-- Auto fallthrough, channel 'SIP/supervisor-00000014' status is 'UNKNOWN'

*CLI> group show channels
Channel                    Group                 Category            
Local/s@phones-a76e;2      agent                 (default)          
1 active channel
Comments:By: laszlovl (lvl) 2012-03-08 08:27:55.958-0600

Some more testing seems to reveal that the bug only manifests when ChanSpy decides to start spying on the *;2* leg of the local channel; every time it decides to spy on the *;1* leg, everything is fine.

By: Richard Mudgett (rmudgett) 2012-03-08 13:30:18.573-0600

Do you have the fix for ASTERISK-19461 installed on your system?

By: laszlovl (lvl) 2012-03-08 13:39:05.294-0600

Yep, the testresults above are from a fresh trunk checkout: revision 358576

By: Matt Jordan (mjordan) 2012-03-13 09:44:56.959-0500

lvl: I'm going to link this issue and ASTERISK-19493 together and treat them as the same, since the end result appears to be the same bug (channel getting orphaned)

By: laszlovl (lvl) 2012-03-15 05:19:57.482-0500

I agree that these two issues probably share the same underlying bug, considering my comment #1 applies to the both of them. Do note however that in this issue there are no visible signs of an orphaned channel: there is no stuck channel in 'sip show channels' or 'core show channels' - it's just the channel group that hangs.

By: laszlovl (lvl) 2012-03-20 18:16:00.763-0500

I just retested this scenario with Jonathan Rose's patch for ASTERISK-19493 applied, but the problem is still there. Same scenario / steps as above.

By: Walter Doekes (wdoekes) 2017-03-22 03:42:33.031-0500

Is this still a problem?

By: Joshua C. Colp (jcolp) 2017-12-19 06:08:46.458-0600

Per the query from [~wdoekes] - is this still a problem?

By: Asterisk Team (asteriskteam) 2018-01-02 08:30:29.899-0600

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].
[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines