Bound the NuGet package search timeout - #19178
Conversation
Add a default timeout to synchronous layout helper executions so hung NuGet searches fail with a clear timeout instead of relying on outer CI hang dumps. Keep caller cancellation flowing as cancellation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19178Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19178" |
There was a problem hiding this comment.
Pull request overview
Adds a three-minute bound to synchronous layout helper executions, preventing aspire add from hanging on NuGet operations.
Changes:
- Adds configurable timeout handling with clear errors.
- Preserves caller cancellation behavior.
- Adds timeout and cancellation regression tests.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Cli/Layout/LayoutProcessRunner.cs |
Implements bounded helper execution and timeout messages. |
tests/Aspire.Cli.Tests/Layout/LayoutProcessRunnerTests.cs |
Tests timeout and caller cancellation behavior. |
Review details
Tip
Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
3 minutes seems like a very long timeout. I'd struggle to wait 3 seconds!. 15 or 30 seconds would seem like a more reasonable timeout to me. |
Description
aspire addcan hang while the bundled NuGet helper is searching package metadata. The helper was already launched withkillOnParentExit, but that only prevents a leaked child after a hard-killed CLI; it does not bound the wait for a live but wedged helper. In CI, that left the 10-minute MTP hang timeout as the first clear failure.This adds a 3-minute timeout to synchronous
LayoutProcessRunner.RunAsynchelper executions. NuGet search and restore timeouts now fail with a clear message, for exampleNuGet package search for 'Aspire.Hosting' timed out after 3 minutes contacting configured NuGet sources..., while caller cancellation still flows as cancellation.The bound lives in
LayoutProcessRunnerrather thanBundleNuGetPackageCachebecause search, restore, manifest creation, DCP stop, and DCP cleanup all share the same synchronous helper wait path.StartAsyncis unchanged because it intentionally returns a background process whose lifetime is owned by the caller.Validation:
RunAsynchad no timeout parameter.CancelAfter(effectiveTimeout)makesRunAsync_WhenProcessDoesNotExitWithinTimeout_ThrowsTimeoutExceptionfail withTaskCanceledExceptionafter the test guard expires.dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"passes: 4,786 succeeded, 33 skipped, 0 failed.Checklist
<remarks />and<code />elements on your triple slash comments?