Skip to content

test: flakes get their root causes fixed - #555

Merged
CMGS merged 3 commits into
mainfrom
test/v0131-flakes
Nov 10, 2026
Merged

CMGS merged 3 commits into
mainfrom
test/v0131-flakes

Conversation

@CMGS

@CMGS CMGS commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Root-causes and fixes the two flaky tests on the v0.1.31 round's open list. Both causes are on the test side; no product behaviour changes.

TestChangingTheLimitMovesAnOpenTunnel (egress; 2/40 under -race on linux/arm64)

  • Cause: a limit switch lets through the unlimited copy chunk already in flight. kick sets a past read deadline, but splice checks it only between chunks.
  • Diagnostic (40 runs of a throwaway test counting sink bytes after the switch):
    • normally +255 KiB at the switch, which is the new bucket's burst, then 256 KiB/s;
    • one run moved +563 KiB within 1 ms, and that crossed the test's 512 KiB target at once.
  • Fix: the test measures the new rate from 50 ms after the switch.
  • Docs: egress.md and the SetLimit doc say the switch lands once the chunk in flight is through. The comment is edited in place.
  • Evidence:
    • 0/40 under -race on linux/arm64;
    • the mutant without kick() on SetLimit fails 3/3.

TestDisablingARunningClaimRevokesItsPacketPath (pool; under full-suite load only)

  • Cause: the claim's first tun_up runs in a goroutine. A disable that beats it records down, up, down; the arm goroutine re-checks and downs the guest again, so the guest ends down, which is correct. The test waited for exactly up, down. Forced with tunUpGate, the verbs are [down, up, down].
  • Fix: the test waits for the first tun_up before it disables.
  • New test: TestADisableBeforeTheFirstTunUpLeavesTheGuestDown pins that convergence.
  • Evidence:
    • 0/20 under -race on linux/arm64;
    • the mutant without the re-down after a late tun_up fails it.

Cost. Tests and docs only.

/simplify: test-only diff of +28/−6. Nothing to fold: the egress fix reuses waitBytes and the tun fix reuses tunVerbsOf and doorOpen.

Gates (fail-fast ship script):

  • lint 0 issues. on darwin and linux; fmt clean; asl clean;
  • race green on darwin and on linux/arm64, except the container-only utils test;
  • comment delta +1/−1, the in-place SetLimit doc edit.

TestChangingTheLimitMovesAnOpenTunnel failed 2/40 under -race on
linux/arm64: a limit switch lets through the unlimited chunk already in
flight (splice checks the kicked deadline between chunks), which reached
the test's 512 KiB target in under a millisecond. The test now measures
the new rate from 50 ms after the switch, and egress.md and SetLimit say
the switch lands after the chunk in flight.

TestDisablingARunningClaimRevokesItsPacketPath timed out under full-suite
load: the claim's first tun_up runs in a goroutine, and a disable that
beats it records down, up, down, while the test waited for up, down. It
now waits for the first tun_up before disabling, and a new test pins
that a disable beating the first tun_up still leaves the guest down.
@CMGS CMGS changed the title test: two v0.1.31 flakes get their root causes fixed test: flakes get their root causes fixed Nov 10, 2026
CMGS added 2 commits November 10, 2026 22:19
…s a redundant down

The diagnostic showed which copy moved the extra bytes: the tx spliced
copy, parked in waitRead when the kick set its past deadline, woke on
data instead. runtime.poll_runtime_pollWait returns ready when the
fd is readable even with the deadline expired, so spliceDrain moved what
the socket held, up to maxSpliceSize (1 MiB), before the next
prepareRead returned the timeout. The test now runs at 2 MiB/s, requires
a burst, one splice chunk and 0.75 s at the new cap to take 700 ms or
more, and fails when more than the burst and one chunk pass the cap's
pace, which a 50 ms late kick does. egress.md and SetLimit name that
bound. The tun test accepts the down the arm goroutine repeats when a
disable lands between tun_up and its armed check.
…and the remaining at-once docs name the splice bound

Taking the time before loading the sink count let a scheduler stall
between them count as bytes past the pace. The local rate constant no
longer shadows x/time/rate. sandboxd-api.md and SetEgressLimit carry
the same one-more-splice caveat as egress.md, which is rewrapped.
@CMGS
CMGS merged commit 0bf7a9d into main Nov 10, 2026
1 check passed
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