[asterisk-bugs] [JIRA] (ASTERISK-29130) prometheus: Crash when scraping bridge

George Joseph (JIRA) noreply at issues.asterisk.org
Wed Mar 31 15:51:15 CDT 2021


    [ https://issues.asterisk.org/jira/browse/ASTERISK-29130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=254410#comment-254410 ] 

George Joseph commented on ASTERISK-29130:
------------------------------------------


We've had another report of this but I think I know what's going on...
In channels_scrape_cb() we get the channel cache then get the count of channels in it. We then use the count to calculate how many channel_metric elements we need.
Then we iterate over ther channel cache. All without locking the channel cache. I think the number of channels in the cache went UP between the time we got the count and the time we started iterating. Since we only had enough metric elements for the original count, we ran out and attempted to set elements that were actually beyond the original allocation.

The same thing happens in bridges_scrape_callback().

> prometheus: Crash when scraping bridge
> --------------------------------------
>
>                 Key: ASTERISK-29130
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-29130
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/General
>    Affects Versions: 18.0.0
>         Environment: OS: CentOS 7
> Version: asterisk-18.0.0-rc2.tar.gz
>            Reporter: Francisco Correia
>            Assignee: Unassigned
>         Attachments: core.1383-brief.txt, core.1383-full.txt, core.1383-info.txt, core.1383-locks.txt, core.1383-thread1.txt
>
>
> Prometheus Resource while building metrics response creates segmentation fault during active call on a Stasis Application.
> {noformat}
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> Core was generated by `/usr/sbin/asterisk -f -g -C /etc/asterisk/asterisk.conf'.
> Program terminated with signal 11, Segmentation fault.
> #0  bridges_scrape_cb (response=0x7f337c0ccc78) at prometheus/bridges.c:129
> 129				PROMETHEUS_METRIC_SET_LABEL(&bridge_metrics[index], 1, "id", (snapshot->uniqueid));
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list