Repository navigation
Conversation
3b3b75b to
3993bdc
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Native process lifetime and concurrent shutdown behavior warrant final human review.
Review effort: Lite
Findings: None
What changed in this PR
Fixes ANCM out-of-process process lifetime handling using caller-owned references and RAII cleanup.
Changes:
- Protects
SERVER_PROCESSreferences during request dispatch. - Adds native ownership coverage and IIS shutdown stress testing.
- Documents ownership requirements and updates test project dependencies.
| File | Description |
|---|---|
src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs |
Adds backend-exit dispatch stress coverage. |
src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/serverprocess.h |
Defines the RAII process pointer and test access. |
src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/processmanager.h |
Documents process ownership requirements. |
src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/processmanager.cpp |
Acquires references safely under lock. |
src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/outprocessapplication.h |
Propagates ownership documentation. |
src/Servers/IIS/AspNetCoreModuleV2/OutOfProcessRequestHandler/forwardinghandler.cpp |
Releases process ownership via RAII. |
src/Servers/IIS/AspNetCoreModuleV2/CommonLibTests/processmanager_owner_tests.cpp |
Adds deterministic lifetime coverage. |
src/Servers/IIS/AspNetCoreModuleV2/CommonLibTests/CommonLibTests.vcxproj |
Builds and links the native ownership tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
BrennanConroy
left a comment
There was a problem hiding this comment.
processmanager_owner_tests.cpp isn't really needed but I won't block on removing it.
It would be slightly better for GetProcess to use SERVER_PROCESS_PTR& pServerProcess so the explicit reset() calls aren't needed.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. |
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Summary
SERVER_PROCESSreference on every successfulPROCESS_MANAGER::GetProcesspath while the process-manager lock still protects the selected slotFixes #68366.
Why
GetProcessreturned a borrowed pointer after dropping the process-manager lock. If the backend exited beforeExecuteRequestHandlerfinished synchronous request setup, the process-exit callback could remove the list reference, release the wait reference, and deleteSERVER_PROCESSand itsFORWARDER_CONNECTIONwhile dispatch still used them.The new reference is acquired under the same shared/exclusive lock that protects process-list removal. The forwarding handler adopts it immediately in
SERVER_PROCESS_PTRand releases it beforeDereferenceRequestHandler, which may delete the handler.The reference deliberately ends after the initial
WinHttpSendRequest. The handler stores noSERVER_PROCESS*for asynchronous completion, and retaining a dead backend for the full HTTP/WebSocket lifetime would change existing process-exit semantics.Compatibility
This changes private implementation inside
aspnetcorev2_outofprocess.dll. The module still exports onlyCreateApplication;IAPPLICATION,IREQUEST_HANDLER, and shim/handler ABI are unchanged. Allocation and deletion remain in the same module. Supported mixed shim/handler versions cannot combine different sides of this internal ownership contract because producer and caller ship in the same request-handler DLL.Validation
AddRefcalls failsProcessManagerTests.GetProcessReferenceSurvivesRemovalFromManagerbecause removal of the list reference destroys the process; restoring them passesThe native test uses the real manager and process refcount path: it acquires through
GetProcess, removes the manager list reference throughShutdownProcess, verifies the caller keeps the process alive, then verifies destruction when the caller releases it.Scope
The pre-existing parent/child wait-reference imbalance and
UnregisterWaitpending-callback behavior are independent shutdown-lifetime concerns and intentionally excluded from this focused change.