Review Board 1.7.16


Make new SIP work make use of threadpool

Review Request #2305 - Created Jan. 31, 2013 and submitted

Mark Michelson
/team/group/pimp_my_sip
Reviewers
asterisk-dev
jcolp, mjordan
Asterisk
This changeset introduces threadpool usage into the new SIP work. Function calls that originate from the Asterisk core (such as channel callbacks) and from PJSIP's event handling thread (such as incoming request/response callbacks) now push their work into the SIP threadpool.

The benefits to this changeset are:
1) Frees up PJSIP event handling threads so that they can process more incoming SIP messages at a time
2) Places similar SIP tasks into their own task queue so that they can be completed in sequence, thus limiting resource contention. So far, session tasks are the only ones that use this mechanism

I added a new API call called ast_sip_push_task_synchronous(), that allows for you to push a task to a servant and block until the task completes. This is used in several cases where Asterisk threads need to make use of a PJSIP feature but need to have the result of the pushed task before returning. A good example of this is gulp_request() in chan_gulp. We need to call some PJSIP routines to set up a UAC and a dialog and such. But we also need to return a new ast_channel before gulp_request() returns.

Please have a look over this to see if I've made any obvious mistakes (e.g. memory leaks, tasks being not being executed in the threadpool when they should be)
I've run the OPTIONS test in the testsuite and can confirm that Asterisk shutdown does not crash Asterisk any more. I also ran incoming and outgoing calls and ensured that they completed correctly with no issue.
Review request changed
Updated (Feb. 11, 2013, 11:06 a.m.)
Address review feedback

* Mention what PJSIP methods are unavailable in session supplements that involve a pjsip_rx_data
* Improve log message when failing to push an indication task
* Uncomment threadpool shutdown
* Did an audit of channel usage to be sure that things will stay fine after a hangup. Didn't have to make any changes for this at this time.
Ship it!
Posted (Feb. 12, 2013, 12:38 a.m.)

   

  

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.