tibrewalpratik17 opened a new pull request, #13679:
URL: https://github.com/apache/pinot/pull/13679

   Fix for #13629 
   
   Currently, we maintain a map `_gaugeValues` in the `AbstractMetrics` class 
for gauge values. When adding a new gauge, we lock the entire operation of 
adding the gauge to the `_gaugeValues` map and the `metricsRegistry` factory 
simultaneously. However, there was a bug where the removal was not done under a 
lock. This led to a race condition when `removeGauge` and `setValueOfGauge` 
were called almost simultaneously. This could result in a scenario where the 
gauge is removed from the `_gaugeValues` map, then `setValueOfGauge` takes a 
lock on the map, adds it back to `_gaugeValues`, and registers it with 
`_metricsRegistry`, but then `removeFromMetricsRegistry` from the `removeGauge` 
method kicks in, removing it from `_metricsRegistry`.
   
   This was specifically caught in our scenario by the way we have implemented 
our `_metricsRegistry`. We have a thread where we loop through all the gauges 
every 10 seconds and emit the value. In our scenario, `_metricsRegistry` was 
missing the gauge altogether because of the above race condition.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to