diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2026-04-13 21:18:32 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <brad@danga.com> | 2026-04-14 06:57:24 -0700 |
| commit | 6aa10576c902b0930c72f0c0113bb6e8636cfd1e (patch) | |
| tree | 2c1d7b53177bbe0ec8379ccb412e482a9e64d970 /control/controlhttp/controlhttpserver/controlhttpserver.go | |
| parent | 49eb1b5d26c7276764fc42e9e823893ffa522b6e (diff) | |
| download | tailscale-6aa10576c902b0930c72f0c0113bb6e8636cfd1e.tar.xz tailscale-6aa10576c902b0930c72f0c0113bb6e8636cfd1e.zip | |
wgengine/magicsock: deflake TestTwoDevicePing compare-metrics-stats
The compare-metrics-stats subtest reset two independent counting
systems (physical connection counters and expvar.Int user metrics)
non-atomically. Background WireGuard keepalives arriving between the
resets could increment one system but not the other, causing
off-by-one packet/byte mismatches in either direction.
Replace the reset-then-compare pattern with snapshot-and-delta:
snapshot both systems before pings, snapshot again after, and compare
the deltas. This eliminates the non-atomic reset window entirely.
As a belt-and-suspenders safety net, tolerate a difference of exactly
one packet (and corresponding bytes) from a stray keepalive that
could still arrive in the narrow window between the two snapshots.
flakestress passes with ~5900 runs (~2800 without -race, ~3100 with
-race) but it also passed previously too. This is an annoying one to
repro.
Fixes #11762
Change-Id: I3447ad67e71c8146e85eed38b7a665033ef9e284
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'control/controlhttp/controlhttpserver/controlhttpserver.go')
0 files changed, 0 insertions, 0 deletions
