Repository navigation
Fix Windows diagnostic server ignoring a client that connects before ConnectNamedPipe - #138447
Open
MattParkerDev wants to merge 1 commit into
Open
MattParkerDev wants to merge 1 commit into
MattParkerDev wants to merge 1 commit into
Conversation
MattParkerDev
requested review from
lateralusX,
mdh1418 and
noahfalk
as code owners
November 28, 2026 05:29
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
This was referenced Nov 28, 2026
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On Windows, a client can connect to the diagnostic server's named pipe between
CreateNamedPipeAand the overlappedConnectNamedPipeinds_ipc_listen.ConnectNamedPipethen fails withERROR_PIPE_CONNECTED, and because no overlapped operation was started,overlap.hEventis never signaled.ds_ipc_listentreats this as success, butds_ipc_pollwaits on that event forever. The connected client's request is never read, and because the pipe instance stays connected, no other client can get through either.This is easy to hit when resuming a process started with
DOTNET_DefaultDiagnosticPortSuspend=1.DiagnosticsClientretriesNamedPipeClientStream.Connectuntil the pipe exists, so aResumeRuntimesent right after process start connects as soon as the pipe appears. When it lands in this window,ResumeRuntimenever returns and the runtime stays paused at startup indefinitely.Fix:
ERROR_PIPE_CONNECTEDcase, signaloverlap.hEventso poll sees the connection, and record it in a newis_client_connectedflag.ds_ipc_accept, skipGetOverlappedResultwhen the flag is set, since there is no overlapped connect to complete.ERROR_IO_PENDINGno longer falls through into theERROR_PIPE_CONNECTEDcase.