Skip to content

Give the nested process chain in ProcessWaitingTests depth-proportional wait budgets - #135608

Merged
jkotas merged 2 commits into
dotnet:mainfrom
pcshrosbree:fix/process-waiting-chain-budgets
Oct 12, 2026
Merged

jkotas merged 2 commits into
dotnet:mainfrom
pcshrosbree:fix/process-waiting-chain-budgets

Conversation

@pcshrosbree

Copy link
Copy Markdown
Contributor

Fixes #118977

Problem

ProcessWaitingTests.WaitChain and WaitAsyncChain start a four-deep chain of RemoteExecutor processes, and every level waits with the same WaitInMS. The root's wait has to cover the start-up, work and exit of all four processes while the leaf's covers one, so the root has the leaf's budget while covering four lifetimes. In every failure stack I have for #118977 the exception is at the root wait, and the four failing durations across three CI runs are 30.6–30.9 s, the 30 s budget of this x86 Checked lane (SlowRuntimeTimeoutModifier is 1 on a Checked runtime; only a Debug runtime, or RISC-V, gets more).

With this assembly's test classes running in parallel (#135160 enabled it on this lane; #135323 removed the remaining macOS-only serialisation), several of the single- and two-process RemoteExecutor tests on the net11.0-windows-Debug-x86-coreclr_checked lane take about 3–10.5 s each and the chains that pass are already at 20–28 s (26.1 / 28.4 s in #135160's own pre-merge Helix experiment), which leaves the root's budget little margin. The synchronous WaitChain fails the same way through a kernel wait on the process handle, so at least in that case the root genuinely had not exited; the asynchronous failures have the same durations and root line. The per-run numbers are in the issue comment.

Change

Give each waiter WaitInMS per process beneath it: leaf 1×, then 2×, 3× and 4× at the root, in both tests, through ChainWaitInMS(int processesBelow). Test-only; the product wait paths and the single-process waiting tests are unchanged. Serialising only the two tests was considered and not measured; it runs against what #135160 was after, and the current budgets give the outer waits no allowance for the nested work in any case.

Validation

Same source (bb146503eeb + this change) on each platform, clr+libs -rc Checked -lc Debug, the inner-loop run of System.Diagnostics.Process.Tests with parallel collections, durations from testResults.xml:

platform runs WaitChain WaitAsyncChain assembly
windows-x86 (Checked clr, 4 logical CPUs → 4 xunit threads) unfixed ×3 → fixed ×3 10.9 / 11.2 / 11.2 → 11.6 / 11.5 / 11.2 s 12.1 / 11.8 / 11.9 → 12.1 / 11.8 / 11.8 s 698 total, 0 failed, every run
linux-x64 (Checked clr, 32 xunit threads) unfixed ×1 → fixed ×2 1.8 → 1.8 / 1.8 s 1.7 → 1.7 / 1.8 s 679 total, 6 skipped, 6 failed† in every run
osx-arm64 (Checked clr, 18 xunit threads) unfixed ×1 → fixed ×2 1.2 → 1.2 / 1.2 s 1.2 → 1.2 / 1.2 s 656 total, 6 skipped, 6 failed† in every run

† The same six POSIX-signal tests (SignalHandler_CanDisposeInHandler ×2, TestCreateNewProcessGroup_HandlerReceivesExpectedSignal ×4) fail identically in the unfixed and fixed runs on both Unix machines, so they predate this change. Both platforms' runs were launched under nohup from a non-interactive shell; a probe of that launch pattern on the Linux machine shows the child process with SIGHUP, SIGINT and SIGQUIT ignored, which points at the launch environment.

The chain durations stay the same within run-to-run noise (the budget grows, the work does not). On the Windows machine the unfixed chain also passes at 11–12 s, so the Helix failure itself did not reproduce locally; whether the lane stops hitting it is for CI history after the change to show.

Note

This PR was prepared with AI assistance (Anthropic Claude, checked by OpenAI Codex) at my request. I reviewed the change and the measurements before opening it.

…al wait budgets

WaitChain and WaitAsyncChain start a four-deep chain of RemoteExecutor
processes and every level waits with the same WaitInMS. The root's wait
has to cover the start-up, work and exit of all four processes while
the leaf's covers one, so the root has the leaf's budget. In the
failure stacks I have for dotnet#118977 the exception is at the root wait,
and the recent failing durations are 30.6-30.9 s, the 30 s budget of
the x86 Checked lane.

With this assembly's test classes running in parallel (dotnet#135160,
dotnet#135323), several of the single- and two-process waiting tests on that
lane take about 3-10.5 s each and passing chains already take 20-28 s,
which leaves the root's budget little margin. Give each waiter WaitInMS
per process beneath it: leaf 1x, then 2x, 3x and 4x at the root.
Test-only; the product wait paths are unchanged, and the single-process
waiting tests keep their budgets.

Fixes dotnet#118977
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 11, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Comment thread src/libraries/System.Diagnostics.Process/tests/ProcessWaitingTests.cs Outdated

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jkotas
jkotas enabled auto-merge (squash) October 12, 2026 02:08
@jkotas
jkotas merged commit e6482f4 into dotnet:main Oct 12, 2026
85 checks passed
@adamsitnik

Copy link
Copy Markdown
Member

Thanks a lot for providing the fix @pcshrosbree !

@ViveliDuCh

Copy link
Copy Markdown
Member

/backport to release/9.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/9.0 (link to workflow run)

@ViveliDuCh

Copy link
Copy Markdown
Member

/backport to release/9.0-staging

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/9.0-staging (link to workflow run)

@ViveliDuCh

Copy link
Copy Markdown
Member

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

ViveliDuCh pushed a commit that referenced this pull request Oct 12, 2026
…Tests depth-proportional wait budgets (#135632)

Fixes #118977 <!-- Issue Number -->

main PR #135608 <!-- Link to PR if any that fixed this in the main
branch. -->

Backport to `release/9.0-staging`.

/cc @ViveliDuCh @pcshrosbree

# Description

<!-- Give a brief summary of the issue and how the pull request is
fixing it. -->

The same `WaitChain`/`WaitAsyncChain` timeout failure seen in main also
occurred in `release/9.0`. Scale each wait budget by the number of
nested processes it covers.

# Customer Impact

<!-- What is the impact to customers of not taking this fix? -->

- [ ] Customer reported
- [x] Found internally

Intermittent CI test failures; no product behavior change.

# Regression

<!-- Is this fixing a problem that was introduced in the most recent
release, ie., fixing a regression? -->

- [ ] Yes
- [x] No

Existing test timeout issue; no known product regression.

# Testing

<!-- What kind of testing has been done with the fix. -->

#135608 reports both chain tests passing on Windows x86, Linux x64, and
macOS arm64. No additional local tests run for this backport; CI is
still in progress and currently has failures.

# Risk

<!-- Please assess the risk of taking this fix. Provide details backing
up your assessment. -->

Low: test-only timeout adjustment. Assertions and product code are
unchanged.

Co-authored-by: Peter Shrosbree <peter.shrosbree@gmail.com>
ViveliDuCh pushed a commit that referenced this pull request Oct 13, 2026
…epth-proportional wait budgets (#135643)

Backport of #135608 to release/11.0

/cc @ViveliDuCh @pcshrosbree

The same `WaitChain`/`WaitAsyncChain` timeout failure seen in main also
occurred in `release/11.0`. Scale each wait budget by the number of
nested processes it covers.

# Customer Impact

<!-- What is the impact to customers of not taking this fix? -->

- [ ] Customer reported
- [x] Found internally

Intermittent CI test failures; no product behavior change.

# Regression

<!-- Is this fixing a problem that was introduced in the most recent
release, ie., fixing a regression? -->

- [ ] Yes
- [x] No

Existing test timeout issue; no known product regression.

# Testing

<!-- What kind of testing has been done with the fix. -->

#135608 reports both chain tests passing on Windows x86, Linux x64, and
macOS arm64. No additional local tests run for this backport; CI is
still in progress and currently has failures.

# Risk

<!-- Please assess the risk of taking this fix. Provide details backing
up your assessment. -->

Low: test-only timeout adjustment. Assertions and product code are
unchanged.

Co-authored-by: Peter Shrosbree <peter.shrosbree@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Diagnostics.Process community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: System.Diagnostics.Tests.ProcessWaitingTests.WaitAsyncChain

4 participants