Repository navigation
[wasm] Wait for killed processes and retry WBT project cleanup - #137297
Conversation
On Windows, BlazorPublishRunTest intermittently fails in SharedBuildPerTestClassFixture.RemoveDirectory because publish\wwwroot is still in use. The xharness webserver runs with that directory as its working directory, and ToolCommand.Dispose() kills it without waiting for exit, so the handle can outlive the kill. Wait for the killed process to exit in ToolCommand.Dispose(), and retry transient IO/access failures when deleting build directories. Fixes #137269 Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
…project cleanup Port of #137297. On Windows, BlazorPublishRunTest intermittently fails in SharedBuildPerTestClassFixture.RemoveDirectory because publish\wwwroot is still in use. The xharness webserver runs with that directory as its working directory, and ToolCommand.Dispose() kills it without waiting for exit, so the handle can outlive the kill. Wait for the killed process to exit in ToolCommand.Dispose(), and retry transient IO/access failures when deleting build directories. Co-authored-by: Copilot App <[email protected]>
…project cleanup Port of #137297. On Windows, BlazorPublishRunTest intermittently fails in SharedBuildPerTestClassFixture.RemoveDirectory because publish\wwwroot is still in use. The xharness webserver runs with that directory as its working directory, and ToolCommand.Dispose() kills it without waiting for exit, so the handle can outlive the kill. Wait for the killed process to exit in ToolCommand.Dispose(), and retry transient IO/access failures when deleting build directories. Co-authored-by: Copilot App <[email protected]>
|
/ba-g Failures are unrelated The sole failure in build 1674053 is The final Helix monitor summary accounts for all 320 work items, with only this one failing. All build jobs succeeded, including Windows and Linux Mono/CoreCLR Wasm.Build.Tests builds. The PR only adds bounded waiting after process termination and bounded directory-deletion retries; neither explains this missing Helix execution result. The precise dead-letter cause is unavailable, but there is no reported failure in the changed cleanup paths. Note This comment was generated with the assistance of GitHub Copilot. |
|
/backport to release/11.0 |
|
Started backporting to |
|
/backport to release/10.0 |
|
Started backporting to |
…project cleanup (#137298) Fixes Issue #137269 main PR #137297 # Description On Windows, `BlazorPublishRunTest` intermittently fails in `SharedBuildPerTestClassFixture.RemoveDirectory` because `publish\wwwroot` is still in use. The xharness webserver runs with that directory as its working directory, and `ToolCommand.Dispose()` kills it without waiting for it to exit, so the handle can outlive the kill. This waits up to 30 s for the killed process to exit in `ToolCommand.Dispose()`, and retries transient `IOException`/`UnauthorizedAccessException` failures (10 attempts, 1 s apart) when deleting build directories. Manual port: the files live under `Common/` on this branch, and 8.0 kills via the taskkill-based `KillTree`. # Customer Impact None. Test infrastructure only (Wasm.Build.Tests); reduces CI flakiness on Windows. # Regression No. # Testing `Wasm.Build.Tests` compiles locally. The failure is intermittent and Windows-only; CI on this PR exercises the change. # Risk Very low. Test-only change; no product code is affected. # Package authoring N/A — test infrastructure only; no package changes. > [!NOTE] > This PR was generated with the assistance of GitHub Copilot. Co-authored-by: Copilot App <[email protected]>
…project cleanup (#137299) Fixes Issue #137269 main PR #137297 # Description On Windows, `BlazorPublishRunTest` intermittently fails in `SharedBuildPerTestClassFixture.RemoveDirectory` because `publish\wwwroot` is still in use. The xharness webserver runs with that directory as its working directory, and `ToolCommand.Dispose()` kills it without waiting for it to exit, so the handle can outlive the kill. This waits up to 30 s for the killed process to exit in `ToolCommand.Dispose()`, and retries transient `IOException`/`UnauthorizedAccessException` failures (10 attempts, 1 s apart) when deleting build directories. Manual port: the files live under `Common/` on this branch. # Customer Impact None. Test infrastructure only (Wasm.Build.Tests); reduces CI flakiness on Windows. # Regression No. # Testing `Wasm.Build.Tests` compiles locally. The failure is intermittent and Windows-only; CI on this PR exercises the change. # Risk Very low. Test-only change; no product code is affected. > [!NOTE] > This PR was generated with the assistance of GitHub Copilot. Co-authored-by: Copilot App <[email protected]>
… cleanup (#137353) Backport of #137297 to release/10.0 /cc @lewing ## Customer Impact - [ ] Customer reported - [ ] Found internally [Select one or both of the boxes. Describe how this issue impacts customers, citing the expected and actual behaviors and scope of the issue. If customer-reported, provide the issue number.] ## Regression - [ ] Yes - [ ] No [If yes, specify when the regression was introduced. Provide the PR or commit if known.] ## Testing [How was the fix verified? How was the issue missed previously? What tests were added?] ## Risk [High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.] **IMPORTANT**: If this backport is for a servicing release, please verify that: - For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`, not `release/X.0`. - For .NET 10+: The PR target branch is `release/X.0` (no `-staging` suffix). ## Package authoring no longer needed in .NET 9 **IMPORTANT**: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version. Keep in mind that we still need package authoring in .NET 8 and older versions. Co-authored-by: Larry Ewing <[email protected]> Co-authored-by: Copilot App <[email protected]>
…BuildAndPublish (#137368) `MiscTests.MultiClientHostedBuildAndPublish` called `dotnet build`/`publish` directly through `DotNetCommand.ExecuteWithCapturedOutput`, without `-nr:false`. Every other Wasm.Build.Tests build goes through `BuildTestBase.BuildProjectWithoutAssert`, which always passes `-nr:false`. This PR switches the test to `BuildProjectWithoutAssert` with `BuildOptions` or `PublishOptions`, so it gets `-nr:false` (and the helper's binlog output fallback) from the same place as the rest of the suite. For this test, the command line is otherwise unchanged: it runs in the same directory (`_projectDir`) with the same `NUGET_PACKAGES`, `-p:Configuration`, and `-bl`. The helper's `WBTOverrideRuntimePack` path doesn't apply, because `UseWBTOverridePackTargets` is never set to true. The binlog file name changes to the helper's convention. ## Why Over the last 30 days (AzureDevOpsTests), this is the only Wasm.Build.Tests test that fails with: ``` System.UnauthorizedAccessException: Access to the path 'BlazorMultiClientHosted.dll' (or '.exe') is denied ``` The failure appeared in 16 Windows `main` builds, most recently Nov 11. The stack is `SharedBuildPerTestClassFixture.RemoveDirectory` <- `RemoveFromCache` <- `BuildTestBase.Dispose`, so the build itself succeeds and test cleanup fails. **Hypothesis (not proven):** Without `-nr:false`, the build leaves reusable MSBuild worker nodes running, and they keep the server's output locked, so cleanup can't delete the directory. Related: #137297 added a ~9 s cleanup retry and waits for killed `ToolCommand` processes to exit. The wait doesn't apply here, because this test never starts a long-running process, and idle MSBuild nodes can outlive the retry window. If this test still fails the same way after this change, the hypothesis is wrong. ## Related cleanup While doing this, we found that `BuildProjectWithoutAssert` discards the result of LINQ `Append` when it tries to add `-p:WasmBuildOnlyAfterPublish=true`, so `PublishOptions.BuildOnlyAfterPublish` never took effect. That's harmless: `dotnet publish` already defaults `WasmBuildOnlyAfterPublish=true`. #137370 removes the dead code separately. ## Validation Not built or run locally. I skipped the SDK bootstrap and Wasm.Build.Tests dependency build to save disk space. CI will compile it and run the test. > [!NOTE] > This PR description and change were generated with GitHub Copilot. --------- Co-authored-by: Copilot App <[email protected]>
… cleanup (#137352) Backport of #137297 to release/11.0 /cc @lewing ## Customer Impact - [ ] Customer reported - [ ] Found internally [Select one or both of the boxes. Describe how this issue impacts customers, citing the expected and actual behaviors and scope of the issue. If customer-reported, provide the issue number.] ## Regression - [ ] Yes - [ ] No [If yes, specify when the regression was introduced. Provide the PR or commit if known.] ## Testing [How was the fix verified? How was the issue missed previously? What tests were added?] ## Risk [High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.] **IMPORTANT**: If this backport is for a servicing release, please verify that: - For .NET 8 and .NET 9: The PR target branch is `release/X.0-staging`, not `release/X.0`. - For .NET 10+: The PR target branch is `release/X.0` (no `-staging` suffix). ## Package authoring no longer needed in .NET 9 **IMPORTANT**: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version. Keep in mind that we still need package authoring in .NET 8 and older versions. Co-authored-by: Larry Ewing <[email protected]> Co-authored-by: Copilot App <[email protected]>
On Windows,
BlazorPublishRunTestintermittently fails duringSharedBuildPerTestClassFixture.RemoveDirectorybecausepublish\wwwrootis still in use by another process.The xharness
wasm webserverruns withpublish\wwwrootas its working directory.ToolCommand.Dispose()kills it withKill(entireProcessTree: true)but never waits for it to exit. Termination is asynchronous, so the process can still hold its current-directory handle when the fixture deletes the project.Changes:
ToolCommand.Dispose(): after killing the process, wait up to 30 s for it to exit (and log if it doesn't).SharedBuildPerTestClassFixture.RemoveDirectory: retryIOException/UnauthorizedAccessExceptionup to 10 times, 1 s apart, before rethrowing the existing error.Validation:
Wasm.Build.Testscompiles locally (macOS). The Windows Blazor tests weren't run locally; the failure is intermittent and only shows up on Windows.The reported failures are on release/8.0 and release/9.0, where these files live under
Common/and 8.0 uses ataskkill-basedKillTree. Manual ports will follow.Resolves #137269
Note
This PR was generated with the assistance of GitHub Copilot.