[sr-dev] [kamailio/kamailio] Presence: Fix startup inconsistency in presentity hash table (#809)

Stefan Kohlhauser notifications at github.com
Mon Oct 10 13:58:36 CEST 2016


The problem we experienced was that the kamailio would sometimes send empty NOTIFYs after start. This problem was persistent until the kamailio was restarted again.

We found out that this would occur in case the presentity table contained more or equal expired entries than valid ones.
Lets assume we have only one presentity entry on startup and it is expired. This entry is ignored when filling the hash table. A PUBLISH generates a new valid entry in the DB and the hash table _before_ the first cleanup run resulting in an expired and a valid entry in the DB and a publ_count of 1 for the URI in the hash table. On first run of the cleaner it removes the expired entry from the DB and reduces the publ_count to 0 which means removing it from the hash table despite the fact that there is still a valid DB entry.
Since the following PUBLISHes are subsequent ones only the DB is updated but not the hash table. The effect are hash table misses resulting in the omission of fetching the XML body from the presentity table for every following lookup.

This patch primarily tries to make the usage of publ_count consistently represent the number of presentity entries in the DB. And to make up for the short times an expired entry is in the hash table (after startup and for recently expired ones during runtime) the entry's expires time is checked on fetching the body for a NOTIFY.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/809#issuecomment-252598365
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20161010/a73c73bb/attachment.html>


More information about the sr-dev mailing list