Repository navigation
Closed
Labels
kind:bugSomething does not behave as documentedkind:testTest coverage, flakes, fixtures or the e2e harnessprio:mediumScheduled
Description
Summary
Investigation of flaky CI tests in the deCDN project. The CI infrastructure is well-structured with proper allowed-skips, but several test suites have inherent flakiness issues.
Flakiness Issues
1. Probe rate limiter tests (crates/node/tests/probe_loopback.rs)
probe_rate_limit_returns_rate_limited_close_code(line 864): Two-connection form flaked undercargo nextest runbecause the second connection's establishment raced the first's teardown on the shared client endpoint. The accept loop assumed it would receive exactly twoIncomings. Code comment lines 860-862 explicitly documents this.probe_three_layer_limiter_rejects_per_peer(line 967): Same connection retry racing issue with per-peer bucket draining.
2. Known QUIC driver wedge (crates/node/tests/support/mod.rs:197-237)
- The
shutdownhelper has a known open defect "stranded upstream QUIC driver" (Pull legs run on ephemeral per-serve runtimes, stranding shared connection drivers (HTTP + QUIC) #1675). A single stuck task costs the fullSHUTDOWN_TIMEOUT(10s), and it warns rather than fails to avoid red CI for a known defect. Named counterdecdn_node_pull_abandon_drain_timeout_totalplus the stalled line keep it visible.
3. DHT integration tests (crates/node/tests/dht_integration.rs)
- Race conditions in routing table convergence
- Negative cache TTL expiry under live clock (anchored on
Instant, cannot be driven bytokio::timepause/advance) - Bucket eviction under node departure
4. Test scheduling non-determinism
cargo nextest runschedules tests differently across runs- Multi-threaded tests have contention issues
5. E2E concurrency
--test-threads 2used specifically because "more at once oversubscribes the 4-core runner and turns poll-based assertions flaky" (ci.yml:824-826)
6. Timeout sensitivity
- Fixed-duration
tokio::time::timeout()calls affected by CI runner load - Several tests use
start_paused = true+tokio::time::advance()to fast-forward past deadlines (e.g.,probe_read_timeout_resets_stream_with_zero_codeat line 731)
7. Shutdown/teardown pattern
- The
shutdownfunction covers the whole call rather than one stage/endpoint, so a single wedge costs the full 10s timeout
Recommendations
- Fix the two-connection race in probe rate limiter tests by restructuring to avoid racing connections on a shared endpoint
- Address the QUIC driver wedge (Pull legs run on ephemeral per-serve runtimes, stranding shared connection drivers (HTTP + QUIC) #1675) in the
shutdownfunction — currently only warns, should fail or have better handling - Reduce DHT test parallelism or add more deterministic seeding
- Maintain
--test-threads 2for E2E journeys (already configured) - Keep
start_paused = truepattern for tests needing to fast-forward past timeouts (already used in probe tests) - Monitor the
#1675QUIC driver issue
CI Status
The test job runs cargo llvm-cov nextest --workspace --lcov and completed successfully. The ci-success gate has allowed-skips for known-flaky tests (fmt, clippy, test, doctest, deny, doc, public-api, adr-book-list, pr-title, markdownlint, anvil-e2e-settlement, anvil-e2e-journeys, solidity-fmt, solidity-build-test, solidity-coverage, solidity-solhint, solidity-slither, solidity-aderyn, ed25519-vectors, docker-build, packaging).
Metadata
Metadata
Assignees
Labels
kind:bugSomething does not behave as documentedkind:testTest coverage, flakes, fixtures or the e2e harnessprio:mediumScheduled
Type
Fields
Priority
None yet
Projects
- StatusShow more project fieldsDone
Activity
yigitdot commentedon Aug 26, 2026
Triage against
main(969c7d5)Verified each of the seven claims. Four are stale — they describe defects that later PRs closed, and the issue read historical rationale left in code comments as live defects. Three survive, all in
crates/node/tests/dht_integration.rsplus one constant collision in the shared teardown helper.Incomingsshutdown's fixedABANDON_DRAINsleep; warns rather than failsConnDrain::wait_drainedplusdecdn_node_pull_abandon_drain_timeout_total. Warn-not-fail is deliberate and documented. One real defect behind it — row 7.round_timeoutand the 750ms negative-cache TTL are both latency assertions on a coverage-instrumented runner. Fixed.--test-threads 2.github/workflows/ci.yml:782-783).tokio::time::timeoutsensitivityshutdowncovers the whole call, so one wedge costs the full 10ssupport/mod.rs:161-166); the value was the defect. Fixed.Measured, so the claims are not taken on faith
Three runs of
cargo nextest run -p decdn-node --test dht_integration— plain, under 12 spinning background loops, and undercargo llvm-cov nextest— on a 14-core darwin box:bucket_overflow_……converges_after_peer_departs…converges_via_closer_nodes_second_round…negative_cache_expires_after_ttl…tolerates_unreachable_peerBeing precise about what this does and does not show:
tolerates_unreachable_peeris demonstrably mis-sized. It burns 6.3–6.4s against a 12s guard, and 12s is exactlyMAX_LOOKUP_ROUNDS (4) × round_timeout (3s)— the implementation's own worst case, so the guard sits on the ceiling rather than clearing it. The figure is load-independent across all three runs, so it is fixed timeout cost: the lookup burns two rounds, while its comment claimed "at most oneround_timeout(3s)".llvm-cov, a far harsher amplifier, and Flaky serve-miss coalescing tests under CI coverage contention (early-eof / peer hang, B3 #1656) #1673 was attributed to exactly that starvation.What landed
Duration::ZEROTTL (entries hold an absolute expiry;contains_activereadsexpiry <= nowas elapsed). The 1100ms sleep goes with it: 1.40s → 0.35s. Wall-clock TTL passage stays covered by thenegative_cacheunit tests andnode_origin_pull's refusal suite.round_timeoutsplit — a convergence budget sitting just aboveDHT_CLIENT_TIMEOUT(so the per-RPC cap stays the binding constraint), and the short budget named only where a timeout is the point. The hang guard now clears the lookup's ceiling instead of matching it.support::shutdowninstead of one unboundedclose().awaitand a fire-and-forget spawn. A handler panic in the accept loop now fails its test rather than being discarded by the abort.SHUTDOWN_TIMEOUT(10s) equalledABANDON_DRAIN_CAP(10s) — one ceilinged abandon drain could consume the whole teardown budget before the first close was attempted, reporting0/M endpoints closedfor a run in which nothing was wedged. A false stranded-driver reading on the one channel that keeps Pull legs run on ephemeral per-serve runtimes, stranding shared connection drivers (HTTP + QUIC) #1675 visible. Raised to clear the drain cap.Deliberately not done
retries— this repo's practice is one issue per flake with a real diagnosis (flaky: probe_rate_limit_returns_rate_limited_close_code races on the application close code (sees 0 instead of 16) #1594, Flaky serve-miss coalescing tests under CI coverage contention (early-eof / peer hang, B3 #1656) #1673, Flaky deadlock: node-origin pull-leg abandon-drain races Endpoint::close(), hangstestjob under CI load (node_origin_pull::a_probe_cache_hit_drops_a_provider_no_longer_admitted) #1718, flaky(ci): node_origin_pull::a_wedged_channel_open_does_not_starve_the_candidate_loop burns the 300s nextest backstop, reddeningteston main (#1718 stopgap does not bound it) #1779, flaky: two_concurrent_pulls_to_one_provider_share_the_channel_ledger fails under coverage instrumentation #1826 all closed that way). Retries would mask exactly that signal.crates/node/tests/dht_lookup.rscarries the identical unbounded fire-and-forget teardown. Same defect, different binary, not implicated in these flakes → filed as test(node): dht_lookup.rs tears endpoints down unbounded and fire-and-forget #1831.Verification:
cargo clippy --workspace --all-targets -- -D warningsclean,cargo fmt --checkclean,cargo doc -p decdn-nodeclean, fulldecdn-nodepackage 1038/1038 passing with noSLOWand noteardown exceededlines, anddht_integrationgreen 20/20 in a repeat loop.test(node): de-flake the DHT integration suite and unpin two teardown…
test(node): de-flake the DHT integration suite and unpin two teardown…