Repository navigation
Remove flaky Go goroutine-count test from GeneratedRuntime_PassesGoRuntimeHardeningTests - #21474
David Fowler (davidfowl) wants to merge 2 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21474Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21474" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are blocking approval.
No open issues 🎉
What changed in this PR
This PR stabilizes the generated Go runtime’s cancellation regression test without changing production code or weakening its goroutine-growth threshold.
Changes:
- Replaces
runtime.NumGoroutine()measurements with live-goroutine counts from stop-the-world stack dumps. - Grows the dump buffer until complete and preserves the existing 50-goroutine threshold.
- Documents why scheduler counters can temporarily include exited goroutines during garbage collection.
| File | Description |
|---|---|
| tests/Aspire.Hosting.CodeGeneration.Go.Tests/AtsGoCodeGeneratorTests.cs | Adds a live-goroutine counting helper and uses it in the cancellation regression test. |
Review effort: Balanced
Karol Zadora-Przylecki (karolz-ms)
left a comment
There was a problem hiding this comment.
I do not think we need such test at all. Models are already knowledgeable about Go enough to flag indiscriminate goroutine creation.
|
Karol Zadora-Przylecki (@karolz-ms) Thanks for the review. I've moved this back to draft while we settle on a direction. Evidence
Options
Could you confirm (a), and whether "such test" means only the goroutine-count subtest or the whole 🤖 Posted by AspireAgent (AI Agent) |
runtime.NumGoroutine can briefly count exited goroutines as running while the GC frees their stacks, so the delta in TestRegisterCancellationDoesNotParkGoroutinePerToken flaked after the previous test spawned 5000 goroutines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per review feedback, drop TestRegisterCancellationDoesNotParkGoroutinePerToken from the generated Go runtime hardening tests instead of deflaking it. The test measured process-wide goroutine counts, which are noisy on busy runners. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2acd3c5 to
249207d
Compare
|
Karol Zadora-Przylecki (@karolz-ms) I've updated the PR to remove the test as you suggested. It now deletes only 🤖 Posted by AspireAgent (AI Agent) |
Tests selector1 / 100 PR test projects · 0 PR jobs, from 1 changed file. Selected PR test projects (1 / 100)
Selected PR jobs (0)none How these were chosen — grouped by what changed🧪 Job reasonsnone Selection computed for commit |
Description
Removes the flaky Go runtime test
TestRegisterCancellationDoesNotParkGoroutinePerTokenfrom the script thatGeneratedRuntime_PassesGoRuntimeHardeningTestsruns. This follows review feedback: we don't need a goroutine-count test for this.Why
The test compared the process-wide
runtime.NumGoroutine()before and after registering 1000 cancellation tokens. That count includes goroutines the test doesn't own (runtime/GC workers, goroutines from earlier tests still exiting), so on a busy runner it went over its 50-goroutine limit without any leak. Example: run 41074175594, Windows, first attempt,registering 1000 tokens left 1222 more goroutines running.Frequency: since the test landed in #21194, it failed in 1 of 128 first-attempt
Hosting.CodeGeneration.Gojobs (1/64 on Windows, 0/64 on Ubuntu). Locally it failed 8 of 900 runs under CPU stress.An earlier revision of this PR deflaked it by counting live goroutines from a stack dump. Per review, this PR now removes the test instead.
Scope
GeneratedRuntime_PassesGoRuntimeHardeningTestsare unchanged, including cancellation ID uniqueness, cancellation notification and malformed frames/handles.Validation
Aspire.Hosting.CodeGeneration.Go.Tests(AtsGoCodeGeneratorTests) passes locally: 40/40, includingGeneratedRuntime_PassesGoRuntimeHardeningTestswith Go installed.Checklist
🤖 Posted by AspireAgent (AI Agent)