<p>Kirsty Tyerman has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9087">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, 9 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/87/9087/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 28282dc..ebc13a7 100644<br>--- a/channels/chan_iax2.c<br>+++ b/channels/chan_iax2.c<br>@@ -12551,6 +12551,7 @@<br> <br> static void *network_thread(void *ignore)<br> {<br>+ int res;<br> if (timer) {<br> ast_io_add(io, ast_timer_fd(timer), timing_read, AST_IO_IN | AST_IO_PRI, NULL);<br> }<br>@@ -12560,9 +12561,14 @@<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>- break;<br>- }<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 && res != -EINTR)<br>+ {<br>+ ast_log(LOG_ERROR, "Thread exit =%s \n", strerror(errno));<br>+ break;<br>+ }<br> }<br> <br> return NULL;<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: newchange </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: 1 </div>
<div style="display:none"> Gerrit-Owner: Kirsty Tyerman <kirsty.tyerman@boeing.com> </div>