mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
TestClientSideJailing waited only for each node's netmap to show the
peer with the expected IsJailed bit, then made a single 1s DialTCP for
each direction. But a peer's endpoints, DERP home, and disco key reach
the other node via separate map updates that can land after the peer
first appears in the netmap. If the first dial's WireGuard handshake
initiation is sent before then, magicsock drops it ("Failed to send
handshake initiation: no UDP or DERP addr") and wireguard-go does not
retry for 5s, so every "should succeed" dial in that window fails.
That matches the CI failures on the race-root-integration job: both
dials in not_jailed, and sometimes the uni_jailed n2-to-n1 dial too,
failed with exactly 1s/2s subtest durations.
This is a test bug, not a jail propagation bug: the jailed state and
the data plane peer routes and jailed filter are installed under the
same LocalBackend lock as the netmap the test polls.
Retry the dials that should succeed until they connect (up to 20s).
The dials that should fail still get a single attempt, since a late
path can only make them fail more. Also drop the flakytest.Mark.
The flake didn't reproduce unaided locally (0/192 runs; 0/95 with
-race and 2 CPUs). Delaying testcontrol's processing of endpoint
updates by 200ms reproduces it deterministically:
before: 95/95 runs failed (with 200ms injected delay)
after: 0/136 runs failed (with 200ms injected delay)
after: 0/71 runs failed (-race, taskset 0-1, no injection)
Fixes #17419
Change-Id: I779d173d5d6c01fe878848cdfe049e7f29d20775
Signed-off-by: Brad Fitzpatrick <[email protected]>