diff options
author | David M. Lee <dlee@digium.com> | 2013-08-16 16:03:34 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-08-16 16:03:34 +0000 |
commit | f29d969a7969b1122b5039747550c1cb039abd23 (patch) | |
tree | 1a58f7d5b3da514304442e9e596c22008a66c62e /main/stasis_cache_pattern.c | |
parent | a4ffa9f72b3ae9d26d8b190fd05f4f21c6c3544b (diff) |
Stasis: address refcount races; implementation comments
Change r395954 reordered some stasis object destruction, which should
have been fine. Unfortunately, it caused some hard to reproduce issues
related to objects being accessed after they had been destroyed. The
patch in r396329 fixed the destruction order problem; this patch
addresses the underlying issue. A few other stasis-related fixes were
also added.
* Add ref-bumps around areas where objects may get transitively
destroyed. (For example, where we lock a topic, unref a subscription,
which unrefs the topic, which explodes the topic when we try to
unlock it.)
* Wrote an extensive doxygen page about Stasis implementation,
relationships between objects, lifecycles of objects, how the
refcounting works, etc. Many other comments were added, corrected, or
cleaned up.
* Added an assert to the topic dtor to catch extra ref decrements.
* Fixed type used after destruction errors for graceful shutdown in
stasis_channels.c.
* I added two unit tests in an attempt to catch destruction order
issues. Since the underlying cause is a race condition, though, the
tests rarely failed even when the code was wrong.
* Fixed a leak in stasis_cache_pattern.c.
(closes issue ASTERISK-22243)
Review: https://reviewboard.asterisk.org/r/2746/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_cache_pattern.c')
-rw-r--r-- | main/stasis_cache_pattern.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/main/stasis_cache_pattern.c b/main/stasis_cache_pattern.c index 0ee57ba24..381fdd989 100644 --- a/main/stasis_cache_pattern.c +++ b/main/stasis_cache_pattern.c @@ -177,6 +177,9 @@ void stasis_cp_single_unsubscribe(struct stasis_cp_single *one) stasis_unsubscribe(one->forward_cached_to_all); one->forward_cached_to_all = NULL; stasis_caching_unsubscribe(one->topic_cached); + one->topic_cached = NULL; + + ao2_cleanup(one); } struct stasis_topic *stasis_cp_single_topic(struct stasis_cp_single *one) |