[Home]

Summary:ASTERISK-30239: Prometheus plugin crashes Asterisk when using local channel
Reporter:Joeran Vinzens (jvinzens)Labels:
Date Opened:2022-09-19 06:40:05Date Closed:2022-09-27 06:16:03
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_local Resources/General
Versions:19.6.0 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-30237 res_prometheus: Crash when scraping bridges
Environment:default Debian / Ubuntu no fancy stuffAttachments:( 0) ari.sh
( 1) extensions.conf
( 2) pjsip.conf
Description:We use ARI to create Channels. There are local Channels.
The Asterisk crashes if there are local channel and if queried by

When we reproduce it it crashes ever time at the same spot.

1. we produce an incoming Channel by placing a call from a softphone
2. we create an local channel using ARI
if we now query /metrics provided by res_prometheus asterisk will crash

Attached is a bundle of configs and a shell script where you can see what is going on. (it is dirty just to reproduce the issue)

the script is ment to create a local channel, two bridges and put the incoming channel into first bridge, local channel in both bridges and than create an outgoing PJSIP Channel and place this one into the the bridge, the incoming channel is not in. So at the end we would have incoming Call -> Bridge -> local Channel -> Bridge -> outgoing Channel

Attached is the Script
extensions.conf
pjsip.conf
Comments:By: Asterisk Team (asteriskteam) 2022-09-19 06:40:12.513-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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Joshua C. Colp (jcolp) 2022-09-19 06:46:14.964-0500

I think this is the same underlying issue as ASTERISK-30237 but I'll leave this one open too and linked.

By: Holger Hans Peter Freyther (zecke) 2022-09-19 10:40:41.261-0500

Indeed. It does look like a duplicate. It seems the code doesn't handle "AST_BRIDGE_FLAG_INVISIBLE" flags and then crashes with a null snapshot. Taking the check from res/ari/resource_bridges.c seems to make it stop crashing and I will push a fix tomorrow (unless somebody beats me).

By: Friendly Automation (friendly-automation) 2022-09-27 06:16:04.496-0500

Change 19368 merged by Friendly Automation:
res_prometheus: Do not crash on invisible bridges

[https://gerrit.asterisk.org/c/asterisk/+/19368|https://gerrit.asterisk.org/c/asterisk/+/19368]

By: Friendly Automation (friendly-automation) 2022-09-27 06:16:12.680-0500

Change 19369 merged by Friendly Automation:
res_prometheus: Do not crash on invisible bridges

[https://gerrit.asterisk.org/c/asterisk/+/19369|https://gerrit.asterisk.org/c/asterisk/+/19369]

By: Friendly Automation (friendly-automation) 2022-09-27 06:16:29.458-0500

Change 19306 merged by Friendly Automation:
res_prometheus: Do not crash on invisible bridges

[https://gerrit.asterisk.org/c/asterisk/+/19306|https://gerrit.asterisk.org/c/asterisk/+/19306]

By: Friendly Automation (friendly-automation) 2022-09-27 06:19:31.922-0500

Change 19367 merged by Joshua Colp:
res_prometheus: Do not crash on invisible bridges

[https://gerrit.asterisk.org/c/asterisk/+/19367|https://gerrit.asterisk.org/c/asterisk/+/19367]