[asterisk-dev] [Code Review] 2596: Rework stasis cache clear events
David Lee
reviewboard at asterisk.org
Thu Jun 6 08:34:14 CDT 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2596/#review8818
-----------------------------------------------------------
trunk/include/asterisk/stasis.h
<https://reviewboard.asterisk.org/r/2596/#comment17345>
You should note that the data in the message it the current snapshot from the cache.
trunk/main/stasis_cache.c
<https://reviewboard.asterisk.org/r/2596/#comment17348>
There's a potential problem with pulling the snapshot from the cache instead of creating the snapshot fresh.
Since the cache updates happen asynchronously in the Stasis thread pool, this could be an old snapshot. Not a problem currently, but will be if someone tries to use that snapshot as the final state of the object.
What's more problematic is that for a very short lived object, it may attempt to create the cache_clear message before there's an entry in the cache. Then the clear creation will fail, and the cache will have a ZOMBIE SNAPSHOT THAT WILL NOT DIE.
trunk/main/stasis_cache.c
<https://reviewboard.asterisk.org/r/2596/#comment17349>
id_fn will return NULL if the message is of the wrong type. This will happen for the channel_snapshot clears that get forwarded to the endpoint cache.
If id_fn returns NULL, this should just forward the message and return.
trunk/main/stasis_cache.c
<https://reviewboard.asterisk.org/r/2596/#comment17350>
Once you handle id_fn returning NULL, this comment will be a lie. Remove the comment and change this to an ast_log(LOG_ERROR
- David Lee
On June 6, 2013, 8:21 a.m., opticron wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2596/
> -----------------------------------------------------------
>
> (Updated June 6, 2013, 8:21 a.m.)
>
>
> Review request for Asterisk Developers and David Lee.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> This reworks the stasis cache clear mechanism such that an actual snapshot message is published inside of the cache clear message instead of the stasis_cache_clear structure (the ID and message type) which has been removed. This allows multiple caches to consume the same clear message and avoids the problems of needing to clear unknown secondary caches which may be keyed on different parts of the snapshot.
>
> This also resolves an issue where a channel snapshot could be cleared from the channel snapshot cache multiple times if multiple threads called ast_hangup on the channel at the same time.
>
> This also resolves an issue where an endpoint snapshot was published after it was cleared from the cache, thus repopulating it in the cache.
>
>
> Diffs
> -----
>
> trunk/include/asterisk/stasis.h 390501
> trunk/main/bridging.c 390501
> trunk/main/channel.c 390501
> trunk/main/endpoints.c 390501
> trunk/main/stasis_cache.c 390501
> trunk/tests/test_stasis.c 390501
>
> Diff: https://reviewboard.asterisk.org/r/2596/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> opticron
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130606/4086749e/attachment-0001.htm>
More information about the asterisk-dev
mailing list