Conversation
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.
Summary
SERVER_PROCESSreference on every successfulPROCESS_MANAGER::GetProcesspath while the process-manager lock still protects the selected slotRelated to #68366.
Rationale
GetProcesscurrently returns a borrowed pointer after dropping the process-manager lock. If the backend exits beforeExecuteRequestHandlerfinishes reading the process object, the process-exit callback can remove the list reference, release the wait reference, and delete bothSERVER_PROCESSand itsFORWARDER_CONNECTIONwhile request dispatch is still using them.The forwarding handler does not retain the raw
SERVER_PROCESS*across asynchronous completion, so this proposal deliberately holds the new reference only through the synchronous setup and initialWinHttpSendRequestcall. It does not keep a dead backend or its parent WinHTTP connection alive for the full HTTP/WebSocket lifetime.The existing fast-path miss also inspects the process-list slot without a lock before deciding to acquire the exclusive lock. This proposal acquires the exclusive lock unconditionally after a fast-path miss and performs the second readiness check there.
Compatibility
This changes only private implementation inside
aspnetcorev2_outofprocess.dll; the module exports onlyCreateApplication, so there is no native ABI or public API change. The shim/handler contract and handler version-selection behavior are unchanged.The acquisition and release ship together in the same request-handler DLL. Older pinned handlers remain unchanged; supported shim/handler combinations do not mix the internal
GetProcessimplementation with a caller from another binary.Validation
Passed:
OutOfProcessRequestHandler.vcxprojOutOfProcessRequestHandler.vcxprojRunCodeAnalysis=trueThe repository does not currently expose a deterministic test seam between
GetProcessreleasing its lock and the forwarding handler's first process access. Before this is considered ready to merge or service, it should gain a barrier-based red/green stress test that:The adjacent parent-launcher/child-listener wait-reference imbalance identified during investigation is intentionally excluded from this focused proposal.
Fixes: #68366