<p>Kirsty Tyerman has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9187">View Change</a></p><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;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/9187/1</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 e51561a..4e3816e 100644<br>--- a/channels/chan_iax2.c<br>+++ b/channels/chan_iax2.c<br>@@ -12583,6 +12583,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>@@ -12592,7 +12594,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/9187">change 9187</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/9187"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib4c32562f69335869adc1783608e940c3535fbfb </div>
<div style="display:none"> Gerrit-Change-Number: 9187 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kirsty Tyerman <kirsty.tyerman@boeing.com> </div>