Attached is a bundle of changes to presence module. We deployed opensips1.6 and saw a number of different failures under production load. This patch isn't finished quality: it is just snapshot of where I stand now. I thought it worth sharing the issues I've seen so far. A clean solutions really require larger change outside the scope of just the presence module. I'll send email to the list about these ideas.
This includes:
* Partial bug fix for non-unique totags. The hash-table and DB code for deleting subscriptions assumes that the totag is unique. But the totag has only 16 bits of possible uniqueness per server (it is CRC of branch info). IN practice, easy to get totag collisions after few thousand subscribers. Patch includes fix to the hash-table side but the DB side is still broken. For now, code just does nothing to DB when deleteting a subscription, and just lets it expire out.
* Bug fix for expiring subscriptions from DB prior to updating. Subscriptions that we renewd (via reSUB) are deleted from DB prior to writing the new (unexpired) time into the DB. Change to do DB delete after sync.
* Bug fix for "if ( foo & NO_UPDATE_DB) when NO_UPDATE_DB is zero value. Note that at least one other module has same bug and is not patched here.
* Addition of statistics for presence module. The isn't cleanest of implementations because the DB restore function runs before statistics are available. Would be much cleaner if DB restore could run after stats are available.
* Addition of new 'activeSubs' mi command to help trace down these problems.
* More info in many of the log messages to help trace down these errors.
* Addition of 'override_481_code' as work-around for bad resiprocate clients. We use this option to force a 5xx code instead of standard 481 since some versions of resip get stuck with 481.
* Change to NOTIFY code to node register a response callback function if subscription is being terminated. No point is looking for 481 response if sub is terminated.
* Fix for expires_offset as discussed previously to prevent subscriptions walking to zero length.
patch file
Hi Kennard,
Thank you for this complex patch - some issues are really bugs that we were not aware of and the additions seem useful. I will review this patch and send comments if I have any. I will not apply it until you say it's the final version.
Regards,
Anca