Summary:ASTERISK-27705: chan_iax2: Stops listening for traffic
Reporter:Kirsty Tyerman (ktyerman)Labels:patch
Date Opened:2018-02-27 21:07:31.000-0600Date Closed:2018-06-14 10:18:41
Versions:14.5.0 Frequency of
Environment:Fedora 27Attachments:( 0) asterisk-iax.patch
Description:The chan_iax module in asterisk gets into a state where the module's recv-q keeps increasing and can no longer reach it's iax2 peers. Phone calls to the broken server from remote servers will no longer establish as asterisk can not create the IAX channel.

Making a call from one server to another server that is no longer responding is still possible as the DUNDi module is still running, so the user can still discover any numbers on the remote server. However when attempting to establish the call, asterisk will complain when trying to dial the IAX channel since the IAX peer is no longer responding.

In the Asterisk CLI:

[Feb 2 01:31:10] WARNING[23862][C-00000001]: app_dial.c:2530 dial_exec_full: Unable to create channel of type 'IAX2' (cause 20 - Subscriber absent)


* Doing an "iax2 reload" in asterisk will not work because this does not unload and load the module, it just reads in the config file.
* Doing a "module unload chan_iax2.so" followed by a "module load chan_iax2.so" or a "systemctl stop/start asterisk" will resolve the issue.

The iax2 module is not handling timeout and EINTR case properly. Mainly when there is an interupt to the kernel thread. In case of ast_io_wait recieves a signal, or timeout it can be an error or return 0 which eventually escapes the thread loop, so that it cant recieve any data. This then causes the module
s receive queue to build up on the kernel and stop any communications via iax in asterisk.

The proposed patch is for the iax module, so that timeout and EINTR does not exit the thread.

1. Setup two asterisk servers and peer them using iax.
2. In our case we were able to easily reproduce the error when we set the timing interface to res_timing_dahdi.so and plugged in our custom DAHDI hardware to the computing platform.

Asterisk 14.5.0
Fedora 27
Kernel: 4.13.16-302.fc27.x86_64
Comments:By: Asterisk Team (asteriskteam) 2018-02-27 21:07:32.214-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Kirsty Tyerman (ktyerman) 2018-02-27 21:08:38.743-0600

Patch to chan_iax module.

By: Joshua C. Colp (jcolp) 2018-03-12 08:00:28.628-0500

Would you like to put this up for review on Gerrit yourself? If not it will be up to another individual to do so and take it through the process.

As well Asterisk 14 no longer receives bug fixes, it only receives security fixes. This change would only go into Asterisk 13 and 15.

By: Asterisk Team (asteriskteam) 2018-03-26 12:00:01.340-0500

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

By: Kirsty Tyerman (ktyerman) 2018-06-04 20:37:40.224-0500

This patch has been submitted for review on Gerrit for Asterisk 15. See here: https://gerrit.asterisk.org/9087

By: Asterisk Team (asteriskteam) 2018-06-04 20:37:40.738-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Friendly Automation (friendly-automation) 2018-06-14 10:18:42.181-0500

Change 9187 merged by Joshua Colp:
chan_iax2: better handling for timeout and EINTR


By: Friendly Automation (friendly-automation) 2018-06-14 10:19:28.314-0500

Change 9087 merged by Joshua Colp:
chan_iax2: better handling for timeout and EINTR


By: Friendly Automation (friendly-automation) 2018-06-14 10:26:47.141-0500

Change 9188 merged by Joshua Colp:
chan_iax2: better handling for timeout and EINTR