Summary:ASTERISK-11748: IAX2 out of threads - spinning 100% when frame delivery to * is slow
Reporter:P. Christeas (xrg)Labels:
Date Opened:2008-03-28 15:00:37Date Closed:2008-05-06 15:34:35
Versions:Frequency of
Description:Have managed to narrow the following problem:

Scenario: We have an IAX2 call bridged to some (SIP) slow channel. Then, after some packets are queued, we see them piling up in the IAX2 channel, causing it to race (100% CPU) or even use up all its threads (marked as func="socket_process"). The sound then gets choppy and call may be cut.

Setup:  call --> <IAX2+jb> --> [* box ] --> <slow SIP link>
cpu is 1.4GHz Athlon, speex -> ilbc conversions also require cpu

Problem: IAX2 uses a non-blocking multi-thread read fn() which processes the frames and tries to deliver them to the * core in iax2_queue_frame(..) . There, it tries to aquire the channel lock and, if not, pauses for 1usec. That is not enough on slow systems, and actually the spinning CPU may throttle the delivery of the frames (thus causing them to bottleneck).

Temp solution: in chan_iax2.c:1443 increase the usleep(1) to usleep(100)..

Comments:By: P. Christeas (xrg) 2008-03-28 15:03:11

In other news, it may be related to ASTERISK-1149550

By: Jason Parker (jparker) 2008-05-06 15:34:31

Since ASTERISK-11038 was fixed, I'm going to go ahead and close this.  If 1.4.20 or later shows the same behavior, please reopen this issue.