Skip to content

Flaky serve-miss coalescing tests under CI coverage contention (early-eof / peer hang, B3 #1656) #1673

Closed

Description

@alpergundogdu

Summary

The serve-miss coalescing code (B3 / #1656) has timing-fragile tests that fail under heavy CI contention (coverage-instrumented full-workspace runs) but pass on fast local cores. This surfaced on PR #1667 (shared payment pool) but is not caused by that PR's payment logic — the pool merge onto main's coalescing serve-miss tips the timing over; a sibling coalescing test is already flaky on main itself.

Flaky tests

  1. crates/node/tests/origin_range_pull.rs::two_concurrent_disjoint_own_origin_misses_two_fetches_no_wedge

    • Fails consistently on PR feat(payments): shared payment pool — capped delegated signers + node-addressed cumulative vouchers #1667's branch under CI's cargo llvm-cov nextest --workspace --no-tests=pass (coverage instrumentation + 2774-test actor starvation on the runner).
    • Error: Error: read frame: frame I/O error: early eof in the test client helper support::read_client_msg — i.e. the server closes one of the two disjoint serves mid-stream (after StreamResponse{ok:true}).
    • Unreproducible on fast local cores — including faithful attempts: exact cargo llvm-cov nextest --workspace, node-suite coverage, and the disjoint coverage binary run 30× under 24 CPU hogs. Passes 25/25 under the heaviest local reproduction achieved.
    • Example CI runs: 31686703399, 31689193542, 31697675329.
  2. Peer-coalescing hang (the pull-through peer coalescing path) — reproduced 3/20 on a clean decdn/main worktree during investigation, i.e. pre-existing flakiness on main independent of the payment pool. (Exact test to be pinned down; it was hit while stress-running the coalescing pull-through suite under CPU starvation.)

What was tried (and why it missed)

Three serve-side fixes on PR #1667, all on the AwaitingDataReader present-bitfield axis, all still red on CI:

  • 255e4768 — re-poll presence over a bounded 100 ms settle on a clean outcome.
  • 222a9bcd — replace it with an await-present watch bounded by a 15 s ceiling.
  • c794f4d1 — on a clean pull, read the authoritative durable data file (store.read/export_range) instead of the lagging observe bitfield (timing-independent by construction).

Instrumentation (local) showed the serve legs, pull, vouchers, and StreamEnd all complete on the happy path, and the 15 s ceiling never fired even at 200 ms — so the earlier fixes were on the wrong axis. But c794f4d1 still fails on CI, so the real mid-stream close is not the serve-encoder present-check — it's elsewhere in the merged coalescing + pool serve-miss (a FillSession/lease teardown, a disjoint miss sharing/attaching to the wrong session, or a session-cancel ordering under starvation), and it only manifests under CI's coverage-starvation.

Recommended next step

Local reproduction is effectively impossible (needs the CI runner's coverage slowdown + full-workspace actor starvation), so instrument → CI → fix from evidence: add capture-on-failure logging (eprintln!, which nextest surfaces) at every serve-miss close/error/cancel/teardown site (serve_leg.rs, serve_encoder.rs, window.rs, crates/cache/src/fill_session.rs mark_ended/detach, the AwaitingDataReader path), push a diagnostic commit, and read the exact server-side close site + reason from the failing CI test job. Then fix the real teardown/session bug (ensure two disjoint misses hold fully independent sessions/leases so neither's completion closes the other). Do not tune another timeout — three attempts prove that axis is wrong.

Interim

Consider whether this class of coalescing test needs a nextest retry/quarantine for CI stability while the underlying race is fixed — but note the disjoint test currently fails consistently on the PR branch (a retry may not rescue it), whereas the peer-coalescing hang is intermittent.

Filed from the shared-payment-pool work (PR #1667); the pool PR is otherwise green (15/16 checks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions