Help save net neutrality! Learn more.
Close

#133 atomic registration handling

trunk
closed-accepted
modules (179)
7
2011-06-30
2010-03-12
No

Hi
Here's a patch we've been using since ~1.3.X and ported until 1.6.X. It seems stable, although some of the functionality was ported by copy-pasting and might need a review (I did not know much about opensips when I wrote it!)

Basically it allows setting db_atomic=1 if you're already using realtime database and will eliminate a race condition when doing re-registration. During normal operation, it's possible that opensips does:

SELECT .... FROM location (checking existing ones)
DELETE FROM location WHERE (timer cleaning up the existing registration)
UPDATE location SET ... (trying to update registration that doesn't exist anymore)

We've had problems with people getting randomly deregistered and after patching we didn't get any more complaints. Using db_atomic=1 requires a database schema change. Depending on whether you use domains or not, you need:
UNIQUE KEY `registration_idx` (`username`,`contact`)
or
UNIQUE KEY `registration_idx` (`username`,`domain`,`contact`)
in the location table.

This is a patch against 1.6.1.

Discussion

  • Bogdan-Andrei Iancu

    Hi Stan,

    Thanks for the patch - I will review it asap and uploaded it on SVN.

    Thanks and regards,
    Bogdan

     
  • Bogdan-Andrei Iancu

    • milestone: --> 976383
    • priority: 5 --> 7
    • assigned_to: nobody --> bogdan_iancu
     
  • Bogdan-Andrei Iancu

    • milestone: 976383 --> trunk
    • status: open --> closed-accepted
     
  • Bogdan-Andrei Iancu

    Hi Stan,

    This patch was uploaded but extensively modified - the idea is the same, but simplified as much as possible. Hopefully nothing from the fix was lost :)

    Thanks and regards,
    Bogdan

     

Log in to post a comment.