[asterisk-dev] [Code Review] 2675: Fix caching topic shutdown assertions

David Lee reviewboard at asterisk.org
Mon Jul 15 16:13:16 CDT 2013


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

Review request for Asterisk Developers.


Repository: Asterisk


Description
-------

The recent changes to update stasis_cache_topics directly from the
publisher thread uncovered a race condition, which was causing asserts
in the /stasis/core tests.

If the caching topic's subscription is the last reference to the
caching topic, it will destroy the caching topic after the final
message has been processed. When dispatching to a different thread,
this usually gave the unsubscribe enough time to finish before
destruction happened. Now, however, it consistently destroys before
unsubscription is complete.

This patch adds an extra reference to the caching topic, to hold it
for the duration of the unsubscription.

This patch also removes an extra unref that was happening when the
final message was received by the caching topic. It was put there
because of an extra ref that was put into the caching topic's
constructor. Both have been removed, which makes the destructor a bit
less confusing.


Diffs
-----

  /trunk/main/stasis_cache.c 394395 

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


Testing
-------

Tests pass without asserting.


Thanks,

David Lee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130715/9d881788/attachment.htm>


More information about the asterisk-dev mailing list