Skip to content

Don't fail isolated tests when job object assignment fails - #1121

Merged
AArnott merged 2 commits into
mainfrom
fix/isolated-test-job-tracking
Jul 27, 2026
Merged

AArnott merged 2 commits into
mainfrom
fix/isolated-test-job-tracking

Conversation

@AArnott

@AArnott AArnott commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

The MultiplexingStreamPerfTests tests (net472 only) intermittently fail in CI — most recently in the merge queue run for #1120 (run 30223830842) — with:

Xunit.MicrosoftTestingPlatform.XunitException: PInvoke.Win32Exception : The parameter is incorrect
   at ProcessJobTracker.AddProcess(Process process) in test/Nerdbank.Streams.Tests/ProcessJobTracker.cs:100
   at TestBase.ExecuteInIsolationAsync(...) in test/Nerdbank.Streams.Tests/TestBase.cs:281

This is unrelated to the pnpm bump in #1120.

Assigning the isolated test host process to a job object is only a best-effort safety net to kill orphaned child processes if the test process dies unexpectedly. It can fail for environmental reasons outside our control (e.g. the process already belongs to a job hierarchy that our job isn't part of, which can happen under the CI agent), so its failure should not fail the test. It is now logged as a warning instead.

Additionally, the Win32 error code is now captured immediately after the failed P/Invoke. The old code called Process.HasExited first, which issues its own interop calls and clobbers the last error — so the reported error code ("The parameter is incorrect") was likely bogus, obscuring the real cause.

`MultiplexingStreamPerfTests` (net472 only) intermittently fail in CI with
`Win32Exception : The parameter is incorrect` thrown from
`ProcessJobTracker.AddProcess`.

Assigning the isolated test host process to a job object is only a
best-effort safety net that kills orphaned child processes if this process
dies unexpectedly. It can fail for environmental reasons outside our
control (e.g. the process already belongs to a job hierarchy that our job
is not part of, as can happen under the CI agent), so its failure must not
fail the test.

Also capture the Win32 error code immediately after the failed P/Invoke.
The previous code called `Process.HasExited` first, which issues its own
interop calls and clobbers the last error, so the reported error code was
unreliable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AArnott
AArnott added this pull request to the merge queue Jul 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 26, 2026
This repo's nuget.config only references nuget.org, so the Azure Artifacts
credential provider is never needed. Installing it queries the GitHub
releases API anonymously, which intermittently fails the build before
anything is compiled:

    installcredprovider.ps1: Unable to resolve the browser download url from
    https://github.com/proxy/api.github.com/repos/Microsoft/artifacts-credprovider/releases/latest
    Error: Response status code does not indicate success: 403 (rate limit exceeded).

copilot-setup-steps.yml already passed -NoNuGetCredProvider; do the same
for the build, codeql and docs workflows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AArnott
AArnott added this pull request to the merge queue Jul 27, 2026
Merged via the queue into main with commit 19dbc9f Jul 27, 2026
8 checks passed
@AArnott
AArnott deleted the fix/isolated-test-job-tracking branch July 27, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant