-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Deadlock in EventPipe when reader tries to take EventPipe config lock while tracing self #1892
Comments
The bandaid fix applied in #1794 has kept this from popping up on my radar, so I believe this underlying issue is still present. We could still go and make the changes I alluded to in my comment on the PR in |
@josalem Thanks! To clarify, is this a test issue only and not a product bug? |
This is a product issue that we added a workaround for in our tests |
As detailed in #1794, when an application is tracing itself there is the potential for a deadlock to occur if the reader tries to take the EventPipe configuration lock while
EventPipe::Disable
(specificallyEventPipe::RunWithCallbackPostponed
) is in progress.This occurs when
EventPipeEventSource
is reading because the Trace Event library uses Regex in its logic and Regex now has a lazily initializedConcurrentDictionary
cache that generates events when used. This causes the staticEventSource
provider for concurrent collections to get created (unless its been instantiated earlier in the process) which will call into native code to create the provider. This requires the config lock in EventPipe. If this occurs duringEventPipe::RunWithCallbackPostponed
, you may deadlock because the reader is waiting on the lock, but the writer is holding it and is blocked because the pipe's buffer is full.See the stacks in #1794 for details.
A couple potential paths to fixing this:
EventPipe::Disable
so that it isn't holding the config lock for the entire duration. Rundown and other parts of disable can run for minutes in big applications, so this shouldn't be holding a global lock like that the entire time.EventPipe::Disable
is in flight.This issue breaks our EventPipe tests, but #1794 added a bypass that needs to be removed once this issue is closed.
CC - @tommcdon @noahfalk @sywhang
The text was updated successfully, but these errors were encountered: