<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9087">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Joshua Colp: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_iax2: better handling for timeout and EINTR<br><br>The iax2 module is not handling timeout and EINTR case properly. Mainly when<br>there is an interupt to the kernel thread. In case of ast_io_wait recieves a<br>signal, or timeout it can be an error or return 0 which eventually escapes the<br>thread loop, so that it cant recieve any data. This then causes the modules<br>receive queue to build up on the kernel and stop any communications via iax in<br>asterisk.<br><br>The proposed patch is for the iax module, so that timeout and EINTR does not<br>exit the thread.<br><br>ASTERISK-27705<br>Reported-by: Kirsty Tyerman<br><br>Change-Id: Ib4c32562f69335869adc1783608e940c3535fbfb<br>---<br>M channels/chan_iax2.c<br>1 file changed, 7 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c<br>index 28282dc..66d1330 100644<br>--- a/channels/chan_iax2.c<br>+++ b/channels/chan_iax2.c<br>@@ -12551,6 +12551,8 @@<br> <br> static void *network_thread(void *ignore)<br> {<br>+ int res;<br>+<br> if (timer) {<br> ast_io_add(io, ast_timer_fd(timer), timing_read, AST_IO_IN | AST_IO_PRI, NULL);<br> }<br>@@ -12560,7 +12562,11 @@<br> /* Wake up once a second just in case SIGURG was sent while<br> * we weren't in poll(), to make sure we don't hang when trying<br> * to unload. */<br>- if (ast_io_wait(io, 1000) <= 0) {<br>+ res = ast_io_wait(io, 1000);<br>+ /* Timeout(=0), and EINTR is not a thread exit condition. We do<br>+ * not want to exit the thread loop on these conditions. */<br>+ if (res < 0 && errno != -EINTR) {<br>+ ast_log(LOG_ERROR, "IAX2 network thread unexpected exit: %s\n", strerror(errno));<br> break;<br> }<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9087">change 9087</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9087"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ib4c32562f69335869adc1783608e940c3535fbfb </div>
<div style="display:none"> Gerrit-Change-Number: 9087 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Kirsty Tyerman <kirsty.tyerman@boeing.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kirsty Tyerman <kirsty.tyerman@boeing.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>