Skip to content

E2E test flake: TestRelayIngressCancellationClosesBothSides #1100

Closed

Description

TestRelayIngressCancellationClosesBothSides fails intermittently on unrelated branches:

    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 AfterFunc goroutine closing clientCloser — Write fails, test passes
  • the still-running io.Copy(upstream, clientReader) — its Read takes the bytes, Write returns 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

  1. orangeCatDeveloper commented on Aug 20, 2026

    @orangeCatDeveloper
    ContributorAuthor
  2. added
    kind/bug
    area/tests
    on Aug 21, 2026
  3. changed the title [-]E2E test flaky: TestRelayIngressCancellationClosesBothSides[/-] [+]E2E test flake: TestRelayIngressCancellationClosesBothSides[/+] on Aug 23, 2026
  4. added a commit that references this issue on Aug 25, 2026
    3a3ec62
  5. aditya-shantanu commented on Aug 26, 2026

    @aditya-shantanu
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/networkarea/testskind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions