Add logging for a hung BuildHost during shutdown - #85908
Open
jasonmalinowski wants to merge 2 commits into
Open
jasonmalinowski wants to merge 2 commits into
jasonmalinowski wants to merge 2 commits into
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Shutdown can still leave processes alive or undiagnosed, and the new behavior lacks regression coverage.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds Helix diagnostics for BuildHost processes that hang during MSBuildWorkspace shutdown.
Changes:
- Extends the shutdown grace period from 0.5 to 5 seconds.
- Captures dumps before terminating hung BuildHosts.
- Moves dump collection into shared test utilities.
Assessment: The approach is reasonable, but callback failures can prevent termination, the TryApplyChanges BuildHost is not instrumented, and regression coverage is missing.
| File | Description |
|---|---|
src/Workspaces/MSBuild/Test/MSBuildWorkspaceTestBase.cs |
Configures Helix dump collection. |
src/Workspaces/MSBuild/Core/MSBuild/MSBuildWorkspace.cs |
Exposes the test hook. |
src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.cs |
Forwards the shutdown hook. |
src/Workspaces/MSBuild/Core/MSBuild/BuildHostProcessManager.cs |
Extends timeout and invokes diagnostics before killing. |
src/Tools/RunTests/RunTests.csproj |
Removes the direct diagnostics dependency. |
src/Tools/RunTests/Program.cs |
Uses the shared dump collector. |
src/Tools/RunTests/DumpCollector.cs |
Removes the local implementation. |
src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj |
Adds the diagnostics-client dependency. |
src/Compilers/Test/Core/DumpCollector.cs |
Introduces the shared dump utility. |
Comment on lines
+561
to
+567
| _process.WaitForExit(milliseconds: 5_000); | ||
|
|
||
| if (!_process.HasExited) | ||
| { | ||
| LogProcessFailure(); | ||
|
|
||
| _beforeKillHungBuildHostProcess?.Invoke(_process); |
This allows it to be used more broadly in other tests.
It's unclear to us if we're getting some build hosts sticking around when we shouldn't; this adds extra logging if a process stays around well after it shold have gone away.
jasonmalinowski
force-pushed
the
add-logging-for-hung-buildhost
branch
from
October 3, 2026 01:24
a5fd468 to
3e70a65
Compare
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.



This increases the timeout to wait for a hung BuildHost, and if we do see one, it'll take a crash dump of the process first.
Microsoft Reviewers: Open in CodeFlow