Increase grace period for BuildHost shutdown - #85881
mwiemer-microsoft wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Will investigate manually before sending to team |
|
@RikkiGibson requesting review |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The timeout path can silently kill a genuinely stuck BuildHost, and the tests do not exercise that path.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Extends BuildHost shutdown tolerance, but incorrectly treats RPC completion as proof of process exit.
Changes:
- Increases shutdown grace period to five seconds.
- Suppresses timeout failures after an acknowledged shutdown request.
- Adds shutdown-related tests.
| File | Description |
|---|---|
BuildHostProcessManager.cs |
Adjusts timeout and failure reporting. |
BuildHostProcessManagerTests.cs |
Adds shutdown disposal tests. |
| if (ShouldReportFailureOnShutdownTimeout(shutdownSucceeded)) | ||
| { | ||
| LogProcessFailure(); | ||
| } | ||
| else | ||
| { | ||
| _logger?.LogTrace("BuildHost did not exit after a successful shutdown request; terminating the process."); | ||
| } |
| [Theory] | ||
| [InlineData(true, false)] | ||
| [InlineData(false, true)] | ||
| public void ShouldReportFailureOnShutdownTimeout(bool shutdownSucceeded, bool expected) | ||
| { | ||
| Assert.Equal(expected, BuildHostProcessManager.ShouldReportFailureOnShutdownTimeout(shutdownSucceeded)); |
| [Theory] | ||
| [InlineData(true, false)] | ||
| [InlineData(false, true)] | ||
| public void ShouldReportFailureOnShutdownTimeout(bool shutdownSucceeded, bool expected) |
There was a problem hiding this comment.
I don't think we should necessarily be testing this. It seems like its just testing a log, and the log depends only on timeout and could just make this super flaky.
| if (!_process.HasExited) | ||
| { | ||
| LogProcessFailure(); | ||
| if (ShouldReportFailureOnShutdownTimeout(shutdownSucceeded)) |
There was a problem hiding this comment.
Is this change actually necessary? Seems like we're just changing log behavior and not really anything else?
|
(marking draft: reviewing value of this PR as a separate fix from #85853 and other related PRs) |

2026-10-01.12 roslyn-CI against main (expires ~2026-10-09, see attachments for persistent logs)
Runs fail sporadically if BuildHost shuts down slowly due to process load. This PR increases timeout from 500 ms to 5,000 ms (5 seconds) and adds a check for the BuildHost exit code on grace period expiry.
This is distinct from #85853: the failure addressed here comes from the process-disposal timeout during BuildHost restart/shutdown, not the manager's unexpected-disconnect callback.
Full attachment for indexing:
Microsoft Reviewers: Open in CodeFlow