[OpenSIPS-Devel] [OpenSIPS/opensips] 54e7ed: [WIP] statistics: fix crash when creating a series...

Răzvan Crainea noreply at github.com
Wed Sep 27 15:06:02 UTC 2023


  Branch: refs/heads/3.2
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 54e7edb159b7da664b5dc8b6632c7045ce5162d3
      https://github.com/OpenSIPS/opensips/commit/54e7edb159b7da664b5dc8b6632c7045ce5162d3
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M statistics.c

  Log Message:
  -----------
  [WIP] statistics: fix crash when creating a series stat

Under normal circumstances, when a statistic is updated, we first search
whether it exists, and if not, we add it to the statistics hash.
However, due to the way it is implemented, searching and adding a
statistic is not atomic, hence, with high concurrency, when adding a new
statistic, we might already find an existing one there. In this case,
the code tries to return that statistic in the `pvar` parameter -
however, that parameter might be a (r/o) function, hence a crash
happens. This commit fixes the crash. Close #3136

However, it returns 0, as if the statistic was properly added - the
problem with this approach is that from the caller's perspective, we do
not know whether the statistic was already there or not, to free the
existing structure - hence this might result into a leak. We are still
working on a solution for this.

(cherry picked from commit 4640465215f131592326363bd0748d9f0e79f04d)





More information about the Devel mailing list