<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2178/">https://reviewboard.asterisk.org/r/2178/</a>
</td>
</tr>
</table>
<br />
<p>Ship it!</p>
<p>- Mark</p>
<br />
<p>On November 1st, 2012, 5:18 p.m., Matt Jordan wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Mark Michelson and rmudgett.</div>
<div>By Matt Jordan.</div>
<p style="color: grey;"><i>Updated Nov. 1, 2012, 5:18 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This is a slightly cleaned up version of Jeremiah Gowdy's patch on ASTERISK-20032.
I'll quote Jeremiah from the issue, as it explains the motivation behind the patch:
"[Jun 21 12:39:18] ERROR[30608] res_timing_timerfd.c: Call to timerfd_gettime() error: Bad file descriptor
[Jun 21 12:39:18] ERROR[30608] res_timing_timerfd.c: Call to timerfd_gettime() error: Bad file descriptor
[Jun 21 12:39:18] ERROR[30608] res_timing_timerfd.c: Call to timerfd_gettime() error: Bad file descriptor
[Jun 21 12:39:18] ERROR[30608] res_timing_timerfd.c: Call to timerfd_gettime() error: Bad file descriptor
The log only seems to contain a single thread that is stuck in this state. Other calls on other channels seem to continue to function. I am working to provide better context surrounding when this error occurs.
---
I've changed the timer interface to make the timer ack function(s) in all of the timer implementations return 0 on success / -1 on failure, and I've changed all the places that call ast_timer_ack check that return code and return error themselves if it fails. This stops the streaming of the timer errors and allowed me to determine which call is getting the error:
[Jun 22 10:46:09] VERBOSE[20352] pbx.c: -- Executing [s@originate:1] Answer("Local/s@originate-3722;2", "") in new stack
[Jun 22 10:46:09] ERROR[20352] res_timing_timerfd.c: Call to timerfd_gettime() using handle 257 error: Bad file descriptor
[Jun 22 10:46:09] ERROR[20352] channel.c: Timer failed in ast_read
[Jun 22 10:46:09] VERBOSE[20352] pbx.c: == Spawn extension (originate, s, 1) exited non-zero on 'Local/s@originate-3722;2'
It seems that the issue happens when channel.c calls ast_timer_ack from ast_read."
This patch doesn't resolve the failure he's seeing where the timer fails in ast_read; however, by propagating the timer errors up from the timing layer to the timer consumers - and by making them bail when they see an error - Asterisk stops spamming/freaking out on the error condition. It doesn't, of course, answer why the Local channel had a bad timer file descriptor in this particular code path - but this seems like a good first step to making the error condition manageable.
Note that a good portion of this patch will apply to 1.8; however, since some of it won't (func_jitterbuffer) and since Jeremiah initially wrote it against 10, I kept it against that branch.
</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-20032">ASTERISK-20032</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/10/res/res_timing_timerfd.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/res/res_timing_pthread.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/res/res_timing_kqueue.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/res/res_timing_dahdi.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/res/res_musiconhold.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/res/res_fax_spandsp.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/main/timing.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/funcs/func_jitterbuffer.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/include/asterisk/timing.h <span style="color: grey">(375450)</span></li>
<li>/branches/10/main/channel.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/bridges/bridge_softmix.c <span style="color: grey">(375450)</span></li>
<li>/branches/10/channels/chan_iax2.c <span style="color: grey">(375450)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2178/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>