Project

General

Profile

Actions

Bug #5088

closed

osmo_stat_item_get_next doesn't properly count skipped values

Added by osmith about 3 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
libosmocore
Target version:
-
Start date:
03/23/2021
Due date:
% Done:

100%

Spec Reference:

Description

src/stat_item.c:osmo_stat_item_get_next() is supposed to return the amount of skipped values (see comment describing the function). But this is broken if there is more than one osmo_stat_item involved.

In detail:
  • stats are tracked for a list of osmo_stat_item_group, of which each has a list of osmo_stat_item, of which each has an array of values.
  • The logic to find skipped entries is based on the global current_stat_item_index in stats.c and global_value_id in stats_item.c. Both are shared for all values, items, groups.
  • Whenever a new value is added to any of the osmo_stat_item's values, global_value_id gets increased by one and the id gets assigned to that value.
  • current_stat_item_index stores the last ID that was reported to all attached reporters (e.g. the log reporter, or a statsd instance).
  • In osmo_stat_item_get_next, the diff from current_stat_item_index to the IDs of the first value that is lower than current_stat_item_index, is assumed to be the number of skipped stat values. But if there is more than one osmo_stat_item, the ID may increase by more than one between the values.

I'm working on a fix.

Actions #1

Updated by laforge about 3 years ago

  • Category set to libosmocore
Actions #2

Updated by osmith about 3 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 90

Fixed in https://gerrit.osmocom.org/c/libosmocore/+/23506 and following patches.

Actions #3

Updated by osmith about 3 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)