Repository navigation
pool: the lock-waiter test helper reads the whole goroutine dump - #704
Merged
Merged
Conversation
At -count>1 the package keeps over a thousand goroutines alive, the dump outgrows the fixed 1 MiB buffer, and the waited-for goroutine is cut off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests only.
go test -race -count=5 ./pool/fails on main: three tests time out inwaitLockWaiterfrom the second iteration on (-count=1, which CI and the gate run, passes). The helper readsruntime.Stack(buf, true)into a fixed 1 MiB buffer and looks for the goroutine that waits on a lock. The package's tests leave about 475 goroutines behind per iteration, so from the second iteration the dump no longer fits and the goroutine it looks for is cut off.Measured on the old helper, full package,
-race -count=5: at every failing wait every poll filled the buffer (n == len(buf), for example 274 of 274 polls); the whole dump was 1.55 MB at about 1270 goroutines in iteration 2, 2.13 MB in iteration 3, 2.71 MB in iteration 4; in one case the waited frame sat at offset 1592084.The helper now grows its buffer until the dump fits (+4 lines). With it the full package at
-race -count=5passes on macOS (256 s) and in a Linux arm64 container (188 s).The goroutines that pile up are per-claim doors and one loop per
outbound.Host(boot doors, proxy servers, tun and SOCKS loops), plus a test client's idle connections and the claim store's retry loop in tests that keep the store broken. They belong to claims the tests still hold when they end: the test manager has no teardown, and each test builds its own host. In the daemon a door ends when its claim is disarmed and the host lives as long as the process, so this is test residue, not a leak in production code; no teardown is added for it here.sbx-gate.shendsGATES PASS.