[asterisk-dev] [Code Review] 4341: stasis transfers: fix race condition on set replace channel

Scott Griepentrog reviewboard at asterisk.org
Thu Jan 15 15:19:16 CST 2015


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

Review request for Asterisk Developers.


Bugs: ASTERISK-24649
    https://issues.asterisk.org/jira/browse/ASTERISK-24649


Repository: Asterisk


Description
-------

After a transfer completes that uses a local replacement channel, stasis receives the stasis transfer message with the details of the transfer and makes changes on the replacement channel.  However, since a separate thread was already started for the purpose of starting stasis on the new replacement channel, this allowed for a race condition.  Occasionally later then normal arrival of the stasis transfer message would result in the stasis app name not being set on the replacement channel before it was needed by the other thread, causing it to fail to start stasis and hang up.

This change moves the operations (assignment of the stasis app name and setting the replacement snapshot on the new channel) into the bridge_stasis_push() callback from the bridge transfer logic.  This allows these steps to be completed earlier and more deterministically, eliminating the race condition.


Diffs
-----

  /branches/13/res/stasis/stasis_bridge.c 430394 
  /branches/13/res/stasis/app.c 430394 

Diff: https://reviewboard.asterisk.org/r/4341/diff/


Testing
-------

The stasis start/end tests that discovered the issue are now passing, and I've not found any other test failures.


Thanks,

Scott Griepentrog

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150115/3ec81e33/attachment.html>


More information about the asterisk-dev mailing list