carlos / platform Public

fix-tunnelclient-upgrade-flake

Fix the #471 tunnelclient flake in TestRoundTripUpgradeEndsWithItsContext/duringthehandshake (test only, no production defect). The test cancelled once the hub had the box's marked 200, but that does not mean the box's Hijack had returned: x/net (v0.60.0, serverConn.writeHeaders) queues the reply to the flush before the 200 reaches the wire, and the handler then selects on that reply and on the stream's close. When the handler goroutine had not run by the time the hub's RST_STREAM was processed, both were ready and Go picked at random; picking the close made Hijack fail with "http2: stream closed", the fixture returned before its conn Read, and the test's wait for that Read timed out. The hub did reset the stream on every run; the box only learned of it in Hijack rather than in Read, which is correct behaviour (the box edge's reverse proxy treats a failed hijack as an error and closes the app conn). The fixture now closes boxEnd.hijacked once Hijack returns, and the test waits for that event as well as the hub's handshake hook before cancelling. Before: 88 of 200 runs failed without -race on DOCS-T1. After: 200/200 under -race, 200/200 without, 500 per -cpu=1,2,4,8, package -count=20 and go vet clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Commits 1
Discussions 0 0 open
Tasks 0/0 done

Discussions

  • No discussions on this branch yet.

Tasks

  • No tasks yet.

Activity