Skip to content
Snippets Groups Projects
  • George Joseph's avatar
    19eef2a6
    res_prometheus: Clone containers before iterating · 19eef2a6
    George Joseph authored
    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
    19eef2a6
    History
    res_prometheus: Clone containers before iterating
    George Joseph authored
    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