[Asterisk-code-review] RFC: endpoint/stasis: Eliminate duplicate events on endpoint... (asterisk[13])

Matt Jordan asteriskteam at digium.com
Mon Jul 20 09:45:35 CDT 2015


Matt Jordan has posted comments on this change.

Change subject: RFC: endpoint/stasis: Eliminate duplicate events on endpoint status change
......................................................................


Patch Set 3:

> (2 comments)

I suspect I know what is going on here, although I'm not sure yet how to fix it. I'll have to think a bit more about that.

For this explanation I'll assume we're going to create endpoint FOO/bar - that is, an endpoint with resource 'bar' in technology 'FOO'.

Endpoints have a slightly strange hierarchy. When you create FOO/bar, the endpoints core implicitly creates a special technology only endpoint named 'FOO', if it didn't exist already. Once that technology endpoint is available, the actual endpoint you requested, 'FOO/bar', is created, and all the messages from 'FOO/bar' are forwarded to 'FOO'. Prior to this patch, this created the following message forwarding relationships between the endpoint topics:

topic(FOO/bar) ===> topic(FOO) ===> topic(ALL ENDPOINTS)
   ||
    =============================>

That second line was actually the problem. Forwarding all of the messages from FOO/bar to both FOO and the special ALL ENDPOINTS topic would ensure that messages were duplicated if what you listened on was the ALL ENDPOINTS topic.

This patch restructures those forwarding relationships such that what you should have is:

topic(FOO/bar) ===> topic(FOO) ===> topic(ALL ENDPOINTS)

So what is the problem?

Well, there is really only a single cache. And we're now hitting it twice.

When a cached entry is created, it first gets handled under the FOO/bar topic. That creates the entry in the cache. It then forwards that on to the FOO topic, which - since the entry is created - now updates it in the cache. That's a bit of extra work, but it is harmless.

However, on a cache clear, we have a problem. Under the FOO/bar topic, we remove the entry from the cache, then forward it along to the FOO topic. The FOO topic attempts to remove the entry for the cache, and of course, it isn't there. Kerblooey.

I'm not sure yet what the right fix for this is yet, but we either need to:
(a) Pass the cache update messages along without updating the underlying cache twice
(b) Have separate and distinct caches between the endpoint topic and the technology endpoint topic

-- 
To view, visit https://gerrit.asterisk.org/570
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie47784adfb973ab0063e59fc18f390d7dd26d17b
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: David M. Lee <dlee at digium.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: No



More information about the asterisk-code-review mailing list