Skip to content
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

Fix deadlock in TestEventListener and re-enable ArrayPool DiagnosticEvent tests #45469

Merged
merged 4 commits into from
Dec 2, 2020

Conversation

sywhang
Copy link
Contributor

@sywhang sywhang commented Dec 2, 2020

Fix #42899.

TestEventListener has a deadlock in its implementation where it tries to lock the _eventSourceList and call EnableEventSource which can try to take the EventListener lock, while the overriden OnEventSourceCreated method tries to grab that same lock (_eventSourceList) while holding the EventListener lock.

The fix is simple - calling EnableEventSource doesn't need to be inside the _eventSourceList lock.

@ghost
Copy link

ghost commented Dec 2, 2020

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

Fix #42899.

TestEventListener has a deadlock in its implementation where it tries to lock the _eventSourceList and call EnableEventSource which can try to take the EventListener lock, while the overriden OnEventSourceCreated method tries to grab that same lock (_eventSourceList) while holding the EventListener lock.

The fix is simple - calling EnableEventSource doesn't need to be inside the _eventSourceList lock.

Author: sywhang
Assignees: -
Labels:

area-Diagnostics-coreclr

Milestone: -

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing!

@sywhang
Copy link
Contributor Author

sywhang commented Dec 2, 2020

CI failures are from #43249 and #44173.

@sywhang sywhang merged commit 784d8f5 into dotnet:master Dec 2, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.Buffers.ArrayPool.Tests.ArrayPoolUnitTests.RentBufferFiresRentedDiagnosticEvent failure
3 participants