[SR-Users] usrloc, timer process and cache cleanup

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 22 19:48:11 CET 2011



On 12/22/11 7:40 PM, Ovidiu Sas wrote:
> The replace solution will mask the real issue.
> The flag that is in the usrloc should switch between update or insert
> and that is the real fix.
Right, that has to be done, but there are some cases when db can become 
inconsistent, due to database unavailability, and then some trick have 
to be done at db layer, example:

- db is unavailable, phone unregisters, contact deleted from memory but 
not from database
- phone register again, usrloc will try insert and will fail - in this 
case it should be update if insert fails (or replace)

The other way around could happen when mistakenly deleting/changing 
records in db, which should not happen, but Murphy says opposite.

Cheers,
Daniel

>
> Regards,
> Ovidiu Sas
>
> -- VoIP Embedded, Inc.http://www.voipembedded.com
>
> On Thu, Dec 22, 2011 at 12:58 PM, Daniel-Constantin Mierla
> <miconda at gmail.com>  wrote:
>> Hello,
>>
>>
>> On 12/22/11 6:19 PM, Andreas Granig wrote:
>>
>> Got the cause of the issue.
>>
>> What happens is that there's an AOR which registers ever 120 seconds.
>> For some reason, the location entry is in usrloc cache, but not in db.
>> What happens now is that usrloc tries an "update" query in the db,
>> because it still assumes that the entry is there, which obviously fails.
>>
>> If you remove the entry from usrloc (kamctl ul rm<aor>), then on the
>> next re-registration it's both inserted into the cache and into the db.
>>
>> Wondering how it could happen to get out of sync, and how we could
>> improve this. Maybe using a "replace into" instead of "update", at least
>> for mysql? Suggestions?
>>
>> is the timer interval parameter of usrloc higher than 120sec?
>>
>> http://kamailio.org/docs/modules/3.2.x/modules_k/usrloc.html#id2494575
>>
>> IIRC, there should be anyhow a flag to mark if the record is in db or not,
>> and based on that do insert or update, maybe something is lost there. If you
>> do 'kamctl ul show __aor__', what are the values for flags fields?
>>
>> Another option, perhaps more portable, but with two db hits is: update and
>> if fails then insert -- considering that these should be corner cases, maybe
>> the performance is not affected much. A blended version is even better, if
>> the db driver supports replace, do replace instead of update (I don't know
>> if replace is faster/slower than update).
>>
>> Cheers,
>> Daniel
>>
>>
>> Andreas
>>
>> On 12/22/2011 05:12 PM, Andreas Granig wrote:
>>
>> Hi,
>>
>> Could you please tell me which of the three timer processes ("timer",
>> "slow timer" or "timer nh") is responsible for cleaning up the internal
>> usrloc cache?
>>
>> Looks like every now and then the cleanup of the internal location cache
>> is starting to fail. Funny thing is that expired locations are removed
>> from the mysql backend, but not from the internal cache. We're running
>> kamailio 3.1.5, are there any known issues fixed since that version?
>>
>> In the meanwhile we're trying to pin the issue down, but maybe someone
>> has a clue...
>>
>> Andreas
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list