Skip to content

Tolerate a late peer request in the cluster late-handoff test - #8892

Merged
piscisaureus merged 1 commit into
mainfrom
piscisaureus/cluster-late-handoff-test
Nov 28, 2026
Merged

piscisaureus merged 1 commit into
mainfrom
piscisaureus/cluster-late-handoff-test

Conversation

@piscisaureus

Copy link
Copy Markdown
Contributor

This keeps the cluster test "a peer's request a DO's late handoff
releases is answered moved" from failing when a CI machine stalls
during the drain. It failed once that way, on a macOS runner.

The test asserted that node 0 logs answering moved to a peer's request
that waited for its handoff. That only happens if the request reaches
node 0 before its in-flight deadline, 2 s into the 4 s stop. A request
that arrives later finds the object already handed off and is answered
moved without waiting, so nothing is logged, although the request
still succeeds on node 1.

  • A missing log line is now reported with a diagnostic that says how
    far into the stop the test sent the request, rather than failing.
  • The outcome is still asserted: the peer's request gets a 200 from
    node 1 with the expected count, the held request a 500, and node 0
    exits cleanly. These alone catch node 0 relaying the waiting request
    instead of answering moved: the relay is cut off at the connections
    deadline and the peer gets a 500.
Kind Added Removed
Implementation 0 0
Tests 17 6

"a peer's request a DO's late handoff releases is answered moved"
asserts that node 0 logs answering moved to a peer's request that
waited for its handoff. That only happens if the request reaches node
0 before its in-flight deadline, 2 s into the 4 s stop. A request that
arrives later finds the object already handed off and is answered
moved without waiting, so nothing is logged. This failed once on a
macOS CI runner where node 0 stalled during the drain.

A missing log line is now reported with a diagnostic that says how far
into the stop the test sent the request, rather than failing the test.
The outcome is still asserted: the peer's request gets a 200 from node
1 with the expected count, the held request a 500, and node 0 exits
cleanly. Those assertions alone catch node 0 relaying the waiting
request instead of answering moved, since the relay is cut off at the
connections deadline and the peer gets a 500.
@piscisaureus
piscisaureus requested review from a team as code owners November 25, 2026 06:58
@piscisaureus
piscisaureus requested a review from ry November 25, 2026 06:58

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💬 Approved with comments — Test-only fix for a timing-dependent failure. One optional suggestion: keep the log assertion on runs that sent the request early.

Findings: 1 suggestion (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 suggestion

The log assertion is now a diagnostic only, so a regression in the waiting path can pass without anyone noticing.

Recommendation: 💬 Optional Nits

  • [SUGGESTION] The waiting path is no longer asserted, even on runs where the request was sent well before the 2 s in-flight deadline. (src/workerd/server/tests/cluster/cluster-test.mjs:2755)
View full review
  • src/workerd/server/tests/cluster/cluster-test.mjs:2755: The test now passes whether or not node 0 made the peer's request wait for its handoff. If a later change makes node 0 answer moved right away, or stops it waiting, the outcome assertions still hold, and a t.diagnostic line is easy to miss in CI. One option is to keep the hard assertion when sentAfter is well under the 2 s in-flight deadline (for example under 1000 ms), and use the diagnostic only when the request was sent late.

✅ All other checks passed

🔒 Security: ✅ LGTM

No security concerns in this test-only change.


📝 Documentation: ✅ LGTM

The updated comment accurately describes both cases the test now tolerates.


Reviewed commit: 447546b1

@piscisaureus
piscisaureus merged commit 3b9f910 into main Nov 28, 2026
24 checks passed
@piscisaureus
piscisaureus deleted the piscisaureus/cluster-late-handoff-test branch November 28, 2026 18:59
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.

3 participants