Repository navigation
Description
TestRelayIngressCancellationClosesBothSides fails intermittently on unrelated branches:
- https://github.com/agent-substrate/substrate/actions/runs/32270460698 (
yelshall/workerpool-pod-metadata) - https://github.com/agent-substrate/substrate/actions/runs/32289001614 (
logs-source-filters) - https://github.com/agent-substrate/substrate/actions/runs/32311722045 (
nighthawk-router-capacity) - https://github.com/agent-substrate/substrate/actions/runs/32325183622 (
kind-ipv6-coredns)
ingress_test.go:123: client stream remained open after relay cancellation
--- FAIL: TestRelayIngressCancellationClosesBothSides (0.00s)
Expected Behavior
The test asserts that cancelling the request context closes both sides of a CONNECT relay.
Actual Behavior
The assertion at ingress_test.go:123 races the close it is checking for.
relayIngressWithHalfClose closes both sides from a context.AfterFunc callback, which runs on its own goroutine. cancel() returning says nothing about whether that goroutine has run. The test asserts immediately afterwards.
clientReader/clientInput is an unbuffered io.Pipe, so the test's Write is claimed by whichever goroutine reaches it first:
- the
AfterFuncgoroutine closingclientCloser—Writefails, test passes - the still-running
io.Copy(upstream, clientReader)— itsReadtakes the bytes,Writereturns nil, test fails
The preceding actor.Read assertion is much harder to hit because it carries a one-second read deadline, which gives the close a full second of slack. The Write has none, which is why the failure is always line 123.
Steps to Reproduce the Problem
go test ./internal/atunnel/ -race -run TestRelayIngressCancellationClosesBothSides -count=10000
Measured on two platforms, 10000 iterations per cell:
| Linux/x86_64, 4 cores (same as CI) | macOS/arm64, 10 cores | |
|---|---|---|
| plain | 1 failure | 8 failures |
-race |
89 failures | 202 failures |
-race widens the window by two orders of magnitude, and CI runs go test -race -v ./..., which is the path these runs fail on. 89/10000 is consistent with 4 hits across the last 70 failed pr-workflow runs.
Specifications
- Version:
origin/main@ 3eaf6c2 - Platform: Linux 6.17.0-1022-azure x86_64, Go 1.26.3; also reproduced on darwin/arm64
Activity
orangeCatDeveloper commentedon Aug 20, 2026
cc Keith Mattix II (@keithmattix)
[-]E2E test flaky: TestRelayIngressCancellationClosesBothSides[/-][+]E2E test flake: TestRelayIngressCancellationClosesBothSides[/+]atunnel: close the relay's both ends before returning
fix: land the three root-caused flaky-test fixes (identity, parking, …
aditya-shantanu commentedon Aug 26, 2026
No failures for TestRelayIngressCancellationClosesBothSides (unit) since 3a3ec62 across 57 runs in the last 7 days — the fix from #1101 landed via #1160 (commit 8a84e26). Marking resolved on the flake dashboard.