[Home]

Summary:ASTERISK-26009: res_ari: Asterisk crashes with several ARI apps connected with subscribeAll=1
Reporter:Sidney VanNess (sidneyvanness)Labels:crash
Date Opened:2016-05-10 12:52:57Date Closed:2017-12-20 06:12:41.000-0600
Priority:CriticalRegression?
Status:Closed/CompleteComponents:Core/Stasis Resources/res_ari Resources/res_ari_events
Versions:13.7.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Ubuntu 14.04.4 LTS, libjansson.so.4.5.0. Also fails with libjansson.so.4.7.0Attachments:( 0) backtrace.txt
Description:============
*Description/How To Reproduce*
{noformat}
$ wscat -c 'ws://localhost:8088/ari/events?api_key=<key>:<password>&app=<appname>&subscribeAll=1'
{noformat}
Run 5 or 10 of these at once with appname different for each one with all
of them subscribing to all events.

Place a call which will emit stasisStart for one of the apps (maybe a few times).

Asterisk should terminate at this point.

*This was done using local channels*

json_mem_free in json.c seems to have the issue.  If you don't free the memory, then it does not terminate.

Of note, the issue seems somewhat similar in nature to the following bug report: ASTERISK-25775

Therefore, we expect the fix to our issue also would result in the resolution of this seemingly related bug report.
Comments:By: Asterisk Team (asteriskteam) 2016-05-10 12:52:58.114-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: Rusty Newton (rnewton) 2016-05-10 16:07:24.204-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: Sidney VanNess (sidneyvanness) 2016-05-11 12:15:29.421-0500

I can't immediately see how to attach the backtrace to a comment, so I've put it here: https://www.dropbox.com/s/v80673jymni8dee/backtrace.txt?dl=0

Steps to reproduce:
Step 1 - Connect to ARI with 6-8 apps making sure &subscribeAll=1 is present.  (I just do this in 6 terminal windows) * You may need more than 6 to cause the issue
wscat -c 'ws://127.0.0.1:8088/ari/events?api_key=<username>:<password>&app=app1&subscribeAll=1'
wscat -c 'ws://127.0.0.1:8088/ari/events?api_key=<username>:<password>&app=app2&subscribeAll=1'
wscat -c 'ws://127.0.0.1:8088/ari/events?api_key=<username>:<password>&app=app3&subscribeAll=1'
wscat -c 'ws://127.0.0.1:8088/ari/events?api_key=<username>:<password>&app=app4&subscribeAll=1'
wscat -c 'ws://127.0.0.1:8088/ari/events?api_key=<username>:<password>&app=app5&subscribeAll=1'
wscat -c 'ws://127.0.0.1:8088/ari/events?api_key=<username>:<password>&app=app6&subscribeAll=1'

Step 2 - Do anything that causes ARI events such as dialing or causing a device state change...

That's it.
* If it doesn't crash, try wscat in more terminals with more app names

Configuration:
Standard asterisk build with no changes.
http enabled and an ARI user for connecting with wscat.

By: Sidney VanNess (sidneyvanness) 2016-05-11 12:17:27.583-0500

Backtrace attached to issue.

By: Rusty Newton (rnewton) 2016-05-12 08:37:40.095-0500

Thanks!

What exact versions of libjansson and PJSIP are you using?

By: Sidney VanNess (sidneyvanness) 2016-05-12 09:01:31.835-0500

libjansson.so.4.5.0. Also fails with  libjansson.so.4.7.0
We're not using PJSIP

Also, we have a workaround for this in place, it appears. Looks like we do not see this crash if we do not subscribe all. However, the procedure outlined above definitely crashes Asterisk consistently, so it should be fixed.

Taking down bounty given functional work-around.
sv

By: Sidney VanNess (sidneyvanness) 2016-05-12 09:43:39.095-0500

Clarification on prior comment
no pjsip module loaded... just chan_sip

By: Corey Farrell (coreyfarrell) 2017-10-23 15:25:00.227-0500

I just tested this with 10 wscat sessions each with different app names, I'm unable to reproduce the crash.  Can you confirm this is still a problem and if so provide a current backtrace?

Note my library is libjansson.so.4.10.0 (jansson-2.10-2.fc26.src.rpm).  I'm unsure if that makes a difference in this issue.

By: Joshua C. Colp (jcolp) 2017-12-20 06:12:34.373-0600

Suspended due to lack of activity. Please request a bug marshal in #asterisk-bugs on the IRC network irc.freenode.net to reopen the issue should you have the additional information requested. 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