Exit worker nodes on Ctrl+C / Restart Manager shutdown (#12776)#13429
Open
sachinsharma3191 wants to merge 2 commits intodotnet:mainfrom
Open
Exit worker nodes on Ctrl+C / Restart Manager shutdown (#12776)#13429sachinsharma3191 wants to merge 2 commits intodotnet:mainfrom
sachinsharma3191 wants to merge 2 commits intodotnet:mainfrom
Conversation
b1f3e07 to
af189a7
Compare
…2776) Worker processes never set s_hasBuildStarted, so the console cancel handler did not cancel work or exit the node. Windows Restart Manager shuts down console apps with CTRL_C_EVENT; handle node mode by cancelling submissions and signaling the active OutOfProcNode / OutOfProcTaskHostNode to shut down.
af189a7 to
98e116e
Compare
b5bf3eb to
98e116e
Compare
…od definition Made-with: Cursor
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
Fixes #12776.
Out-of-proc worker processes (
/nodemode) never sets_hasBuildStarted, so the existingConsole.CancelKeyPresshandler did not callCancelAllSubmissionsor exit the process. Windows Restart Manager shuts down console applications by sending CTRL_C_EVENT (same path as Ctrl+C per platform docs); idle MSBuild workers therefore stayed alive and kept assemblies locked.Changes
OutOfProcNode/OutOfProcTaskHostNodewhile theirRunloop is active.RequestExternalShutdown()to signal_shutdownEventwithBuildComplete.MSBuildApp.Console_CancelKeyPress, whens_isNodeMode && !s_isServerNode, callBuildManager.DefaultBuildManager.CancelAllSubmissions(), then request shutdown on both node types (no-op if not running).Notes
s_buildCancellationSource(cancel runs before the callback);RequestExternalShutdownis a no-op when no worker node is registered.Testing
Microsoft.BuildandMSBuildfornet10.0locally.Fixes #12776