[asterisk-dev] [Code Review]: Call pickup race leaves orphaned channels or crashes.

rmudgett reviewboard at asterisk.org
Tue Aug 30 10:34:14 CDT 2011



> On Aug. 30, 2011, 4:38 a.m., Alec Davis wrote:
> > /branches/1.8/main/channel.c, line 2836
> > <https://reviewboard.asterisk.org/r/1400/diff/1/?file=19855#file19855line2836>
> >
> >     should setting a channel to a ZOMBIE also be done in features.c:set_kill_chan_tech(... ) and any where else before chan->tech->hangup(chan) is called?

No.  The ZOMBIE flag indicates the channel is dead.  It just hasn't been buried yet.  The set_kill_chan_tech() is replacing the channel technology not actually hanging up the channel.

This question has indicated that chan_agent is doing something with the ZOMBIE flag that is no longer going to work with this patch.


- rmudgett


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1400/#review4177
-----------------------------------------------------------


On Aug. 29, 2011, 6:51 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1400/
> -----------------------------------------------------------
> 
> (Updated Aug. 29, 2011, 6:51 p.m.)
> 
> 
> Review request for Asterisk Developers, Alec Davis and irroot.
> 
> 
> Summary
> -------
> 
> Attempting to pickup a call that has been forked to multiple extensions by two users either crashes or fails a masquerade with a "bad things may happen" message.
> 
> This is the scenario that is causing all the grief:
> 1) Pickup target is selected
> 2) target is marked as being picked up in ast_do_pickup()
> 3) target is unlocked by ast_do_pickup()
> 4) app dial or queue gets a chance to hang up losing calls and calls ast_hangup() on target
> 5) SINCE A MASQUERADE HAS NOT BEEN SETUP YET BY ast_do_pickup() with ast_channel_masquerade(), ast_hangup() completes successfully and the channel is no longer in the channels container.
> 6) ast_do_pickup() then calls ast_channel_masquerade() to schedule the masquerade on the dead channel.
> 7) ast_do_pickup() then calls ast_do_masquerade() on the dead channel
> 8) bad things happen while doing the masquerade and in the process ast_do_masquerade() puts the dead channel back into the channels container
> 9) The "orphaned" channel is visible in the channels list if a crash does not happen.
> 
> This patch does the following:
> 1) ast_hangup() sets the zombie flag on a successfully hung-up channel and does not release the channel lock until that has happened.
> 2) __ast_channel_masquerade() is fixed to not setup a masquerade if either channel is a zombie.
> 
> 
> This addresses bugs ASTERISK-18222 and ASTERISK-18273.
>     https://issues.asterisk.org/jira/browse/ASTERISK-18222
>     https://issues.asterisk.org/jira/browse/ASTERISK-18273
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/main/channel.c 333893 
> 
> Diff: https://reviewboard.asterisk.org/r/1400/diff
> 
> 
> Testing
> -------
> 
> Replicated the crash in ASTERISK-18222 with PickupChan() and *8 methods.
> 
> With the patch, the crash no longer happens and the new message of attempting to masquerade into a dead channel is output.
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110830/23d2f923/attachment-0001.htm>


More information about the asterisk-dev mailing list