Review Board 1.7.16


IAX2, prevent network thread starting before all helper threads are ready

Review Request #2427 - Created April 5, 2013 and submitted

Alec Davis
1.8 to trunk
ASTERISK-18827
Reviewers
asterisk-dev
Asterisk
If the first network message was received before iax2_process_thread() was sleeping, the thread would go to sleep, and sleep forever, with deferred frames banking up.

start_network_thread() creates the initial helper threads and the network_thread at the same time (near enough), with no checks that the helper threads were ready before the network thread was created.

Each iax2_process_thread() is required to be at 'ast_cond_wait(&thread->cond, &thread->lock)' before any messages can be accepted.
To achieve this, only start the network_thread after each of the helper threads is ready.

The fix is the same method as find_idle_thread() uses when an iax dynamic thread is created, that then waits for the init_cond to be satisfied.
Prior to fix, iax show threads had thread 1 never finishing, with actions = 0, which means it never got processed.
...
Thread 10: state=0, update=6, actions=1, func=''
Active Threads:
Thread P1: state=1, update=1365045454, actions=0, func='socket_process'
Dynamic Threads:
10 of 10 threads accounted for with 0 dynamic threads

after fix, works as expected.
Review request changed
Updated (April 20, 2013, 11:12 a.m.)
  • changed from pending to submitted
Committed in revision 386185

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.