Skip to content

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

Merged
sywhang merged 4 commits into
dotnet:masterfrom
sywhang:dev/suwhang/42899
Dec 2, 2020
Merged

Fix deadlock in TestEventListener and re-enable ArrayPool DiagnosticEvent tests#45469
sywhang merged 4 commits into
dotnet:masterfrom
sywhang:dev/suwhang/42899

Conversation

@sywhang

@sywhang sywhang commented Dec 2, 2020

Copy link
Copy Markdown
Contributor

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

ghost commented Dec 2, 2020

Copy link
Copy Markdown

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: -

Comment thread src/libraries/Common/tests/System/Diagnostics/Tracing/TestEventListener.cs Outdated

@stephentoub stephentoub left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for fixing!

@sywhang

sywhang commented Dec 2, 2020

Copy link
Copy Markdown
Contributor Author

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