Fix infinite loop in Diagnostics CounterGroup OnTimer method.#53887
Fix infinite loop in Diagnostics CounterGroup OnTimer method.#53887lateralusX wants to merge 1 commit intodotnet:mainfrom
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
|
//CC @josalem |
|
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue DetailsIf a counter event source is disabled while in System.Diagnostics.Tracing.CounterGroup.OnTimer, thread could end up in infinite loop. This happens since _pollingIntervalInMilliseconds is set to 0 when disabled, meaning that we could fail to advance _nextPollingTimeStamp past now: Fix use the local copy of pollingIntervalInMilliseconds and also adds an additional safe quard to make sure it always gets advance event if disabled check on _eventSource.IsEnabled() and lock (s_counterGroupLock), since that case will set _pollingIntervalInMilliseconds to 0 as well even before loaded into local variable.
|
If a counter event source is disabled while in OnTimer, thread could end up in infinite loop. This happens since _pollingIntervalInMilliseconds is set to 0 when disabled, meaning that we could fail to advance _nextPollingTimeStamp past now. Fix makes sure it always gets advance event, even if _pollingIntervalInMilliseconds to 0.
4fdd86c to
88ca1ae
Compare
|
Fixed and merged in #53836. |
If a counter event source is disabled while in System.Diagnostics.Tracing.CounterGroup.OnTimer, thread could end up in infinite loop. This happens since _pollingIntervalInMilliseconds is set to 0 when disabled, meaning that we could fail to advance _nextPollingTimeStamp past now:
Fix use the local copy of pollingIntervalInMilliseconds and also adds an additional safe quard to make sure it always gets advance event if disabled check on _eventSource.IsEnabled() and lock (s_counterGroupLock), since that case will set _pollingIntervalInMilliseconds to 0 as well even before loaded into local variable.