Loading
Remove locks from StateManager to avoid race condition
A race condition is introduced in ValueMetric due to StateManager's locks. When StateManager processes a log event, it notifies all listeners (metric producers) if a state has changed. In ValueMetric, a state change eventually requires querying through a Statemanager function that is held by the same lock as StateManager::onLogEvent. To fix this, we can remove the locks in StateManager and use the locks in StatsLogProcessor to protect StateManager objects. However, we have to ensure that the path to StateManager function calls all originate from StatsLogProcessor. Test: bit statsd_test:* Bug: 145838132 Change-Id: Ie5b747961ffa4cd5c78e86fa5f78472e29a972dd