Skip to content

test: opt-in 550-connection netstack shutdown regression (#151) - #2

Draft
ryjen wants to merge 7 commits into
fix/netstack-close-151from
test/netstack-close-integration-151
Draft

ryjen wants to merge 7 commits into
fix/netstack-close-151from
test/netstack-close-integration-151

Conversation

@ryjen

@ryjen ryjen commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Purpose

Review the opt-in Tailcat integration regression harness for upstream issue #151, separately from the dependency-only change in PR #1.

Base: fix/netstack-close-151 (patched dependency commit 3064e971). Head: test/netstack-close-integration-151. This PR should contain only the new close_regression_151_test.go.

Before/after evidence

Same test body against:

  • Original main at 52fbad323: 2/2 completed 550 short-lived, server-first-close TCP sessions and then Server.Close() failed to return within five seconds.
  • Patched 3064e971: 6/6 completed 550 sessions and Server.Close() returned in ~1.8–2.7 ms after session setup.
  • An early baseline test attempt initially failed at dial 106. The test now has bounded dial retries to tolerate transient ephemeral-port/TIME_WAIT collisions; only runs reaching 550 sessions count as teardown validation.
  • Results establish the observable close hang and recovery, not an instrumented count of gVisor TIME_WAIT endpoints.

Run manually in a dedicated test process:

go test -tags=tailcat_close_stress -run '^TestCloseAfter550ShortTCPSessions151$' -count=1 -timeout=95s .

This test is excluded from the default suite, because the old dependency may leave Server.Close hung. Run it in a dedicated Go test process; the failure path intentionally does not attempt potentially blocking cleanup. It uses a local in-process DERP/STUN setup and has bounded dials, overall execution, and close waiting.

Review guidance

GitHub Actions workflows now run on fork PR #1; at the patched base head 8f2dccedb, Supply-chain, Test (including WebAssembly browser integration), and Nix CI all passed. This test PR is deliberately stacked and has no independent hosted check of the opt-in 550-session test.

Review fix and exact-head validation (2026-10-19)

Commit 74439947 removed the shared handler-completion channel, preventing test-induced handler blocking. The client reading to EOF now establishes server-first completion; TIME_WAIT remains a possible cause of stalled dials, not an independently instrumented count.

The identical revised harness was tested on the original dependency (52fbad323): 2/2 cases completed 550 sessions then Server.Close exceeded the five-second bound. On the updated dependency (3064e97): 3/3 cases passed, with Server.Close returning approximately 1.6–2.1 ms after sessions finished. Full go test -p 2 -count=1 -timeout=120s ./... and tagged go vet -p 2 -tags=tailcat_close_stress ./... passed. Diff checks clean. Review thread resolved; Nix, cross-platform, and supply-chain CI passed on the base PR #1 head.

@ryjen ryjen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of the opt-in regression test at commit 40b78ef.

Required before offering this as an upstream test: The doneServing channel is sent to by every accepted connection, including dials that the client later times out and retries. With as many as 12 attempts per counted session, the fixed count*2 buffer does not bound all sends. A full channel blocks inside OnTCP before its deferred conn.Close(), manufacturing open connections and potentially contaminating the very teardown scenario being tested. Prefer removing this channel and relying on the client's successful read through EOF to establish completed server-first closes; alternatively use an explicitly nonblocking, per-attempt signal with reliable attribution.

Additional improvements: avoid asserting that a failed dial is definitely a TIME_WAIT collision (it is one hypothesis); make the manual standalone-process requirement explicit because the negative test leaves a stuck Close goroutine; document that 550 completed client sessions do not measure 550 gVisor TIME_WAIT endpoints.

The before/after evidence is valuable (old dependency fails 2/2; updated passes 6/6) and the test should stay separate from the minimal dependency PR.

Comment thread close_regression_151_test.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant