On Wednesday 15 December 2010 18:11:40 Daniel-Constantin Mierla wrote:
About one year ago I did quite some fixes, so looking to see if there are any ports from forks might not be wise. It is better to directly report the issue and I can take care. To my knowledge, Alex Hermann reported some potential race when sending requests via tm on sourceforge tracker with a patch, but was not providing the proper fix - I should review that issue as well.
The problem with Kamailio's presence is that it has locking issues. Pua as well as presence itself lock structures while waiting for a reply. If multiple presence updates arrive for the same presentity while the lock is still held, Kamailio will get in a loop consuming 100% cpu.
While I was trying to fix this, Anca Vamanu was at the same time fixing the issue in Opensips. Her solution was a bit cleaner than mine so I ported some of the pua fixes to Kamailio and improved them, but they still need some care. Unfortunately I ran out of time.
Bottom line of the solution is to create a queue of updates for each presentity and feed them one by one to the pua/presence core without locking while waiting for a reply.