[asterisk-dev] [Code Review] 3954: pjsip_options.c: Fix race condition stopping periodic out of dialog OPTIONS request.

rmudgett reviewboard at asterisk.org
Wed Sep 3 09:31:08 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3954/
-----------------------------------------------------------

(Updated Sept. 3, 2014, 9:31 a.m.)


Review request for Asterisk Developers.


Changes
-------

Was able to reproduce the crash involving the periodic OPTIONS request.

In send_out_of_dialog_request(), the call to pjsip_endpt_send_request() cannot clean up any resources because it may or may not call the passed in callback.  It appears that the callback will be called for normal kinds of errors but not for invalid parameter and malloc kinds of errors.


Bugs: AFS-155 and ASTERISK-24295
    https://issues.asterisk.org/jira/browse/AFS-155
    https://issues.asterisk.org/jira/browse/ASTERISK-24295


Repository: Asterisk


Description (updated)
-------

* Fixed send_out_of_dialog_request() to not return error or cleanup resources if pjsip_endpt_send_request() is not successful.

* Fix periodic endpoint qualify OPTIONS sched deletion race by avoiding it.  The sched entry will no longer self stop and must be externally stopped.

* Added REF_DEBUG description tags to struct sched_data in pjsip_options.c.

* Fix some off-nominal ref leaks in schedule_qualify(), qualify_and_schedule().

* Reordered pjsip_options.c module start/stop code to cleanup better on error.


Diffs (updated)
-----

  /branches/13/res/res_pjsip/pjsip_options.c 422562 
  /branches/13/res/res_pjsip.c 422562 

Diff: https://reviewboard.asterisk.org/r/3954/diff/


Testing
-------

I was not able to reproduce the reported crash, but was able to see some problems in the code that could allow the crash to happen.  Review https://reviewboard.asterisk.org/r/3927 for ASTERISK-24212 likely reduced the crash potential of the periodic OPTIONS endpoint qualify poll or was the reason for the reported crash.

Set the qualify_frequency option to different values and reloaded res_pjsip each time.  The OPTIONS poll frequency changed, started, and stopped according to the new qualify_frequency value.


Thanks,

rmudgett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140903/131e0cbe/attachment.html>


More information about the asterisk-dev mailing list