[Release/6.0-staging] Fix issue where the IPC server can fully consume a CPU core and prevent incoming connections #102530#103012
Merged
tommcdon merged 2 commits intodotnet:release/6.0-stagingfrom Jun 4, 2024
Conversation
hoyosjs
approved these changes
Jun 3, 2024
jeffschwMSFT
approved these changes
Jun 3, 2024
Member
jeffschwMSFT
left a comment
There was a problem hiding this comment.
lgtm. we will take for consideration in 6.0.x
Member
Author
|
All failures are known or infra related |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #102413 to release/6.0
If the call to CreateNamedPipe fails here:
runtime/src/native/eventpipe/ds-ipc-pal-namedpipe.c
Lines 372 to 387 in af11dbc
We will end up with an invalid handle for the pipe and the overlapped IO event. There currently is no code that tries to reset the connection and we will repeatedly try to poll an invalid handle, leading to one core being pegged as the wait fails due to an invalid handle and we keep waiting.
This PR makes it so we will call
ds_ipc_listenwhen we run in to an error, which will reconnect to the named pipe. It also adds a delay when we detect an error, so if there are undetected cases that cause the same issue we will at least not consume the whole core we are running on.Customer Impact
The IPC server can fully consume a CPU core and prevent incoming connections.
Regression
Testing
Fix was verified in the customer's environment that it prevents the CPU issue
Risk
Low to Medium - The fix itself is small and reasonable, but this area of the code is hard to reason about all possible code paths due to the async nature of the named pipe APIs.