[Asterisk-code-review] res_prometheus: Clone containers before iterating (asterisk[18])
George Joseph
asteriskteam at digium.com
Thu Apr 1 08:49:09 CDT 2021
George Joseph has uploaded a new patch set (#2). ( https://gerrit.asterisk.org/c/asterisk/+/15724 )
Change subject: res_prometheus: Clone containers before iterating
......................................................................
res_prometheus: Clone containers before iterating
The channels, bridges and endpoints scrape functions were
grabbing their respective global containers, getting the
count of entries, allocating metric arrays based on
that count, then iterating over the container. If the
global container had new objects added after the count
was taken and the metric arrays were allocated, we'd run
out of metric entries and attempt to write past the end
of the arrays.
Now each of the scape functions clone their respective
global containers and all operations are done on the
clone. Since the clone is stable between getting the
count and iterating over it, we can't run past the end
of the metrics array.
ASTERISK-29130
Reported-By: Francisco Correia
Reported-By: BJ Weschke
Reported-By: Sébastien Duthil
Change-Id: If0c8e40853bc0e9429f2ba9c7f5f358d90c311af
---
M res/prometheus/bridges.c
M res/prometheus/channels.c
M res/prometheus/endpoints.c
3 files changed, 31 insertions(+), 5 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/24/15724/2
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15724
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: If0c8e40853bc0e9429f2ba9c7f5f358d90c311af
Gerrit-Change-Number: 15724
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-CC: Friendly Automation
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210401/bf2fb8e0/attachment.html>
More information about the asterisk-code-review
mailing list