Fix #409: TestMaxSessionsRefuses deadlock #411

Merged
crueber merged 1 commit from fix/issue-409 into main 2026-09-12 20:33:01 +00:00
Owner

Test-only fix for #409. TestMaxSessionsRefuses raced the scheduler for the single session slot and could self-deadlock on its own fake transport until the 10-minute package timeout. Changes (internal/sshd/coverage_test.go only, no production-code changes): deterministic slot-holder via captureTransport.entered wait before sess2.Run; held-session teardown (close tr.block AND sess1.Close(), joining sess1.Run); 5s own-deadline budget on every wait with named failures; sibling poll-with-deadline idiom reused, no fixed sleeps. Plus a test-hygiene decision note in docs/go/15_testing.md (law 12). Verified: go test -short -count=1, -race -short -count=1, full package -count=10, targeted -count=10 plain+race, limiter siblings -race -count=3 — all pass, no hangs; gofmt/vet clean. Fixes #409.

Test-only fix for #409. TestMaxSessionsRefuses raced the scheduler for the single session slot and could self-deadlock on its own fake transport until the 10-minute package timeout. Changes (internal/sshd/coverage_test.go only, no production-code changes): deterministic slot-holder via captureTransport.entered wait before sess2.Run; held-session teardown (close tr.block AND sess1.Close(), joining sess1.Run); 5s own-deadline budget on every wait with named failures; sibling poll-with-deadline idiom reused, no fixed sleeps. Plus a test-hygiene decision note in docs/go/15_testing.md (law 12). Verified: go test -short -count=1, -race -short -count=1, full package -count=10, targeted -count=10 plain+race, limiter siblings -race -count=3 — all pass, no hangs; gofmt/vet clean. Fixes #409.
Test-only change; the select/default limiter in sshd.go is unchanged.
- Wait on captureTransport.entered before offering sess2 (no scheduler race).
- Tear down held session via block close AND sess1.Close(), joining sess1.Run.
- Every wait has a 5s budget with a named failure (no 10-minute package panic).
- Docs: test-hygiene decision note in 15_testing.md.
Sign in to join this conversation.
No description provided.