[Home]

Summary:ASTERISK-27026: res_ari: Crash when no ari.conf configuration file exists
Reporter:Ronald Raikes (reraikes)Labels:
Date Opened:2017-06-01 01:34:59Date Closed:2017-06-27 14:40:19
Priority:MinorRegression?Yes
Status:Closed/CompleteComponents:Resources/res_ari
Versions:14.5.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-27030 Asterisk crashes with Segfault in res_ari
is duplicated byASTERISK-27087 res_ari: Crash in Asterisk 13.16 on Startup
is duplicated byASTERISK-27048 Asterik segfault if ari.conf is not found
Environment:Debian 8 Jessie / Raspberry Pi (armhf)Attachments:( 0) backtrace.txt
( 1) Core.zip
Description:Asterisk 13.16.0 and 14.5.0 cause FreePBX 13 and FreePBX 14 to repeatedly crash.  No crashes occur using any previous versions of Asterisk.  Core dump files are created at the rate of approximately 3 per minute as Asterisk restarts (core.zip attached).  During FreePBX installation using Asterisk 13.16.0 or 14.5.0, the following is reported:

Asterisk Started
Reloading FreePBX
Error(s) have occured, the following is the retrieve_conf output:
exit: 1
Exception: Unable to connect to Asterisk Manager from /var/lib/asterisk/bin/retrieve_conf, aborting in file /var/lib/asterisk/bin/retrieve_conf on line 11
Stack trace:
 1. Exception->() /var/lib/asterisk/bin/retrieve_conf:11

No problems occur using any earlier version of Asterisk.

I first reported this to Sangoma, but was advised by Andrew Nagy:

"This should be reported to Digium since it's their code crashing. FreePBX is not causing your crashes, if something that freepbx is writing out is crashing Asterisk then this should still be reported to Asterisk because they should stop it from happening."
Comments:By: Asterisk Team (asteriskteam) 2017-06-01 01:35:00.578-0500

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: Ronald Raikes (reraikes) 2017-06-01 01:42:13.940-0500

Core dump file:

-rw------- 1 asterisk asterisk 62468096 Jun  1 00:56 core.FreePBX-2017-06-01T00:56:37-0500

By: Joshua C. Colp (jcolp) 2017-06-01 04:15:16.698-0500

Thank you for the crash report. However, we need more information to investigate the crash. Please provide:

1. A backtrace generated from a core dump using the instructions provided on the Asterisk wiki [1].
2. Specific steps taken that lead to the crash.
3. All configuration information necesary to reproduce the crash.

Thanks!

[1]: https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace



By: Ronald Raikes (reraikes) 2017-06-01 10:15:16.251-0500

The steps taken that lead to the crash are detailed at:

https://wiki.freepbx.org/display/FOP/Installing+FreePBX+13+on+Debian+8.1

I have a script which I wrote approximately two years ago that executes these steps.  It completes without error and FreePBX+Asterisk runs perfectly with all versions of Asterisk prior to 13.16.0 and 14.5.0.  With these latest versions of Asterisk, crashes begin immediately after the FreePBX installation completes and the following is executed:

fwconsole restart
fwconsole reload

The crashes and core dumps occur at the rate of approximately 3 per minute until the safe_asterisk and asterisk processes are manually killed.

I am unable to produce a backtrace on any of the core dump files:

root@FreePBX:~# gdb -se "asterisk" -ex "bt full" -ex "thread apply all bt" --batch -c core.FreePBX-2017-06-01T09:01:35-0500 > /tmp/backtrace.txt
Aborted (core dumped)
root@FreePBX:~#

I've attached the backtrace.txt file produced up to the point when gdb aborts.


By: Ronald Raikes (reraikes) 2017-06-01 19:27:55.474-0500

Further testing confirms the following:

1. The first step of installing FreePBX is to start Asterisk (/usr/src/freepbx/start_asterisk start).  Asterisk starts successfully and is stable.
2. Asterisk continues to run and is stable throughout the installation of FreePBX.
3. Upon completion of the FreePBX installation, Asterisk continues to run and remains stable through reloads (fwconsole reload).
4. An attempt to restart (fwconsole restart) causes Asterisk to crash and restart (presumably restarted by safe_asterisk), repeating endlessly on its own.  At this point, the only option is to use the kill command to terminate the safe_asterisk and asterisk processes.

Asterisk does not become unusable and crash endlessly using any version prior to Asterisk 13.16.0 and Asterisk 14.5.0.


By: James Finstrom (TheJames) 2017-06-02 10:40:04.852-0500

Ok so I just went through this.

I set this up on a raspi with ron's script. Note this does NOT happen on the distro
My understanding is [~file] tested this with sample configs. After hearing that I touched ari.conf which didn't exist.
Once ari.conf is present no crash.

So the issue should be retitled asterisk crashes when res_ari is loaded without a config.

By: Joshua C. Colp (jcolp) 2017-06-02 10:41:03.107-0500

This issue was introduced by the review at https://gerrit.asterisk.org/#/c/5451/ - if an ari.conf configuration file is not present then the crash will occur. As [~jameswf] discovered after conversing on IRC if you touch the configuration file then Asterisk works as expected, which is why it's not causing problems for everyone.