<div dir="ltr">Asterisk loaded the default timing modules (timerfd and pthreaf), but only res_timing_timerfd is used.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 7:45 PM, Matthew Jordan <span dir="ltr"><<a href="mailto:mjordan@digium.com" target="_blank">mjordan@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Jan 27, 2015 at 11:04 AM, Yousf Ateya <<a href="mailto:y.ateya@starkbits.com">y.ateya@starkbits.com</a>> wrote:<br>
><br>
> Yes, and I supplied the debug logs in the issue ASTERISK-24478 . I was trying to find a solution to this bug.<br>
><br>
> What I am doing now is to run asterisk in debugger (gdb); but it prints TONs of debug message.<br>
> That is why I am looking fot any way to catch the cause of dead locks.<br>
><br>
<br>
</span>I don't think you actually have a deadlock here.<br>
<br>
First, the DETECT_DEADLOCKS option is going to spam you. I'd expect<br>
that when it finds something holding onto a lock for a long period of<br>
time, which is what your debug log shows. That being said, the<br>
DETECT_DEADLOCKS option - once it starts telling you something - isn't<br>
all that useful. Generally, I'd just run with DEBUG_THREADS when<br>
debugging these kinds of things.<br>
<br>
Looking at your 'core show locks' output, you don't actually have<br>
circular waiting. You have a thread that is holding onto an IAX call<br>
number lock (iaxsl[fr->callno]), and a thread that wants it. However,<br>
the thread holding onto the call number lock isn't waiting for another<br>
lock: it's just holding it in transmit_frame.<br>
<br>
Looking at the transmit_frame function:<br>
<br>
static int transmit_frame(void *data)<br>
{<br>
struct iax_frame *fr = data;<br>
<br>
ast_mutex_lock(&iaxsl[fr->callno]);<br>
<br>
fr->sentyet = 1;<br>
<br>
if (iaxs[fr->callno]) {<br>
send_packet(fr);<br>
}<br>
<br>
if (fr->retries < 0) {<br>
ast_mutex_unlock(&iaxsl[fr->callno]);<br>
/* No retransmit requested */<br>
iax_frame_free(fr);<br>
} else {<br>
/* We need reliable delivery. Schedule a retransmission */<br>
AST_LIST_INSERT_TAIL(&frame_queue[fr->callno], fr, list);<br>
fr->retries++;<br>
fr->retrans = iax2_sched_add(sched, fr->retrytime,<br>
attempt_transmit, fr);<br>
ast_mutex_unlock(&iaxsl[fr->callno]);<br>
}<br>
<br>
return 0;<br>
}<br>
<br>
We can see that all paths should be unlocking iaxsl[fr->callno],<br>
assuming we move through the function. My guess is that we're stuck on<br>
iax2_sched_add, but a gdb backtrace would show for sure where that<br>
thread is.<br>
<br>
However, I'll say this - when Corey found a similar problem in<br>
ASTERISK-24451, I wasn't able to reproduce the leak in the IAX usage<br>
of the scheduler. So your problem may not be easily solved unless you<br>
can figure out why the scheduler is misbehaving.<br>
<br>
As a side note: do you have a timing module loaded?<br>
<br>
Matt<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Matthew Jordan<br>
Digium, Inc. | Engineering Manager<br>
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>
Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Yousf Ateya,<br></div><div></div><div>StarkBits</div><div><a href="http://www.starkbits.com" target="_blank">www.starkbits.com</a></div></div></div></div></div>
</div>
<br>
<pre><font size="1" face="Courier New">This e-mail message is intended only for the use of the intended recipient(s).
The information contained therein may be confidential or privileged,
and its disclosure or reproduction is strictly prohibited.
If you are not the intended recipient, please return it immediately to its sender
at the above address and destroy it.
</font></pre>