-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EventCounter publishing thread can hang #53564
Comments
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti Issue DetailsDescriptionWhen listening to EventCounters there is a dedicated thread that is supposed to publish the metric values via EventSource on a periodic timer. However due a bug it is possible to put it into an infinite loop here. This occurs any time _pollingIntervalMilliseconds <= 0, which could occur for a few reasons:
Configuration.NET 5 (but presumably also reproable in .NET 3 and 3.1) Regression?The underlying bug was introduced in 2019 and shipped in .NET Core 3, 3.1, and 5: In August 2020 an additional change was made in .NET Core 5 (and backported to 3.1) which opened the race condition allowing failure reason (2) above to be hit.
|
* default internal state to DateTime.MaxValue * re-check IsEnabled after not holding lock * add test for setting interval to 0
…sEnabled after not holding lock * add test for setting interval to 0
* Fix #53564 * default internal state to DateTime.MaxValue * re-check IsEnabled after not holding lock * add test for setting interval to 0 * simplify fix to just a for loop * remove one more line * Remove loop * Update test to match #54081 Co-authored-by: John Salem <[email protected]>
Description
When listening to EventCounters there is a dedicated thread that is supposed to publish the metric values via EventSource on a periodic timer. However due a bug it is possible to put it into an infinite loop here. This occurs any time _pollingIntervalMilliseconds <= 0, which could occur for a few reasons:
Configuration
.NET 5 (but presumably also reproable in .NET 3 and 3.1)
Regression?
The underlying bug was introduced in 2019 and shipped in .NET Core 3, 3.1, and 5:
However at this point only failure reason (1) above would have been able to trigger it.
In August 2020 an additional change was made in .NET Core 5 (and backported to 3.1) which opened the race condition allowing failure reason (2) above to be hit.
Repro
Expected behavior: No threads should spin in the counter infinite loop
Actual behavior: A thread will hang in that loop
Note: this repro only shows technique (1) to repro the problem. Any fix still needs to account for technique (2) as well.
The text was updated successfully, but these errors were encountered: