[Home]

Summary:ASTERISK-25885: res_pjsip: Race condition between adding contact and automatic expiration
Reporter:Joshua C. Colp (jcolp)Labels:
Date Opened:2016-03-31 09:52:05Date Closed:2016-04-11 16:31:07
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_pjsip Resources/res_pjsip_registrar
Versions:13.8.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:There exists a race condition between res_pjsip_registrar and the code which expires contacts when querying contacts of an AOR. It is possible for the registrar thread and another thread to both retrieve and delete the contact. This is problematic given the following scenario:

1. Registrar retrieves contacts
2. Other thread retrieves contacts
3. Registrar causes deletion of expired contacts
4. Registrar adds new contacts
5. Other thread deletes expired contacts (as it has stale/old contacts)
6. Newly added contacts are gone that were expired

This requires the same contacts to be expired and added, and for it to happen close.

This is seen often enough in the tests/channels/pjsip/registration/inbound/nominal/multiple_contacts/ tests.
Comments: