Repository navigation
Description
Summary
crates/e2e/tests/g_node_07_rotate_key.rs::rotate_key_rebinds_slashability_and_preserves_in_flight_vouchers failed its first attempt and passed on retry (nextest FLAKY 2/3) in a green main ci.yml run on 2026-10-28. The failure text was not captured, and the run's logs have rotated out.
It did not reproduce locally: 0 failures in 54 runs on a loaded 16-core host shared with other agents (load average 20 to 40). This issue records the wall-clock-sensitive spots as candidates and the repro recipe, so the next CI occurrence can be matched to one of them. No fix is proposed until a failure names the cause.
Evidence
- CI: one
FLAKY 2/3for this test in a greenmainci.ymlrun, 2026-10-28. Error text not captured. - Local, at
f2bc01c7, with--retries 0:- 20 runs of the loaded batch
binary(g_node_0*) | binary(node_pull_topup) | binary(cli_fetch_topup)(16 tests per run): target 20/20 pass. - 34 runs of
binary(g_node_07_rotate_key)alone, two or three loops at the same time as the batch: target 34/34 pass. - Other failures in the batch were
cli_fetch_topup(e2e: deposit-short top-up fetch under-pays by about two intervals in CI since #2709 #2718), plus one each ofnode_pull_topup,g_node_06_unbondandg_node_04_blacklist_compliance::regional_blacklist_scope. They are out of scope here.
- 20 runs of the loaded batch
Candidates, most likely first
1. Settlement leg: a claim not submitted before the SIGKILL restart waits 300 s, and the poll gives up at 90 s
Step 7 (served_bytes poll, 90 s) needs the node to redeem the lane up to at least the 2 MiB voucher. The node redeems on the hint path (redeem_one) as each voucher is accepted. Step 5 then restarts the daemon with NodeFixture::restart. That restart is a SIGKILL (respawn_child → child.kill()), so the graceful shutdown's final_redeem_sweep never runs.
If the last hint-path redemption has not been sent when the kill lands, nothing redeems it within 90 s of the restart:
redeemer_loopskips the immediate first tick, so the first sweep after a restart waits a fullredeem_interval_secs. The fixture does not set it, so the default is 300 s (DEFAULT_REDEEM_INTERVAL_SECS).- No hint arrives for the old lane after the restart.
ClientFixturesigns its capability withexpiry = u64::MAX, so no serve-cutoff sweep fires either.- If the kill also lands before the lane store's flush, the voucher advance is lost from disk (
pool_storebuffers lane writes until a flush).
The test then fails with vouchers signed against the pre-rotation identity never settled on-chain. The module doc says the journey "does not try to win" the race between settlement and the rebind. But the outcome it asserts after the restart depends on winning the race against the SIGKILL.
Measured margin: the time from the last pre-restart redeemMany landing to the restarted daemon's deCDN node starting line was 0.47 s to 2.6 s over 54 runs. Every run had both hint-path redemptions landed before the kill. In a one-off experiment with a node.restart() added right after the first fetch (not committed), the second redemption still landed 19 ms before the kill. So the redeemer normally finishes within milliseconds of the fetch returning. To lose the race, the redeemer has to stall for 0.5 s to 2 s or more on the hint path (flush_store_durable fsync, the reconcile multicall, the send and the receipt), relative to the test's two decdn node rotate-key CLI runs. That is plausible on a 4-core CI runner with two anvils, two daemons and the forge deploy competing for CPU and disk, but it was not observed here.
If this is the cause, the fix that matches the runbook is to stop the daemon gracefully before the restart (NodeFixture::terminate, which sends SIGTERM and runs the final redeem sweep). That is the runbook's step 3 "Stop" in adr/appendix-operator-key-rotation.md. The fix should not widen the 90 s poll, because the 300 s tick is what it would really be waiting on.
2. Restart port reuse across parallel journeys
restart() kills the daemon and respawns it on the same bind_port, admin_port and metrics_port. Between the kill and the respawn's bind, a parallel journey's free_ports() can be given one of those ports. That is the documented TOCTOU in crates/e2e/src/lib.rs, and the restart path does not re-pick. The symptom would be node never became healthy after restart (30 s wait_healthy), or the new daemon's admin port answering for a different node.
3. Single-shot reads right after the restart
binding_status()(step 5) reads a value the daemon samples once at bring-up (binding_check::check, oneaddressToNodeIdeth_call). A failed read under load is reported asBindingStatus::Unknown, not retried, and theBoundassertion fails.probe_node_id(live_id, …)(step 6) is one probe with a 5 s timeout and no retry. Under load, a QUIC handshake plus probe to a just-restarted daemon could exceed it. The negative probe (old id) can only fail, so it cannot flake.
4. Post-restart paid fetch
client.fetch after the restart opens a fresh pool and retries for 45 s until the restarted node's PoolOpened projection or getPool resolves it. After a restart, the watchers re-enumerate at a pinned block before tailing. A slow re-enumeration under load eats into that budget.
Shared state with parallel journeys
Each journey has its own anvil (snapshot replay), data dir and ports. What is shared: the one-time bootstrap deploy behind the cross-process lock (absorbed by the ci_scaled budgets), and the ephemeral port space (candidate 2).
Repro recipe
cargo build -p decdn-cli -p decdn-node # nextest does not rebuild the daemon the e2e spawns
export DECDN_NODE_LOG='info,decdn_client=debug,decdn_node::payment_settlement=debug'
# loaded batch; check nextest's run count, and repeat
cargo nextest run -p decdn-e2e --features anvil-e2e --retries 0 --no-fail-fast \
--success-output final --failure-output final \
-E 'binary(g_node_0*) | binary(node_pull_topup) | binary(cli_fetch_topup)'
# alone
cargo nextest run -p decdn-e2e --features anvil-e2e --retries 0 -E 'binary(g_node_07_rotate_key)'
git checkout -- contracts/foundry.lock # the e2e rewrites itWith payment_settlement=debug, a candidate-1 failure shows the lane's last redeem_cycle … outcome="landed" line missing before the second deCDN node starting line, and no redeem_cycle for the pre-rotation pool after it.
Next step
When this flakes in CI again, capture the failing attempt's output (the --failure-output block includes the daemon's log). Match it to a candidate above before changing the test.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
test(e2e): hold every fixture port until its child binds it
test(e2e): hold every fixture port until its child binds it (#2731)
test(e2e): stop the daemon before the G-NODE-07 iroh rotation