Repository navigation
Description
Summary
The anvil-e2e CI job (cargo nextest run -p decdn-node --features anvil-e2e --test anvil_settlement_e2e) intermittently hangs for many minutes instead of completing in ~30s or failing cleanly. It usually passes, occasionally gets stuck. The stuck runs only end because the workflow's concurrency: cancel-in-progress (a later push) cancels them — they show as "cancelled", never a clean red ❌.
Root cause
The hang is the forge script DeployProtocol --broadcast subprocess in run_deploy_script (crates/node/tests/anvil_settlement_e2e.rs:869), invoked via blocking std::process::Command::output() with no timeout. forge script --broadcast intermittently stalls in its broadcast/receipt-wait phase against anvil (a known forge flake, more likely under shared-runner CPU contention). Because the subprocess call is unbounded — and the test has no overall timeout — one stall freezes the entire test.
Evidence
Both observed cancelled runs left forge and anvil alive as orphans at job teardown:
Terminate orphan process: pid (3071) (cargo-nextest)
Terminate orphan process: pid (3317) (anvil_settlement_e2e-…)
Terminate orphan process: pid (3382) (anvil)
Terminate orphan process: pid (3387) (forge) <-- still running at cancel
- Runs: 26836492907 (test step ran 17:25→17:38, 13 min) and 26825763092 (~8.5 min). Same orphan pattern in both.
Command::output()reaps the child on exit, so a still-listed, runningforgemeans the test is blocked inside that call.anvilis spawned afterforge buildand beforeforge script; it's alive too → the liveforgeis the deploy script, not the initial build.- Multi-minute duration rules out a
poll_untiltimeout — every explicit wait in the test is bounded (poll_until≤ 60s,stream_fetch30s, shutdown-close 30s; epoch/expiry time is warped viaevm_increaseTime, no real waiting). Apoll_untilmiss returnsErrand fails fast. Only an unbounded await explains 8–13 min.
Ruled out
- Not the watcher/backfill race (
#762). - Not the alloy filter poll interval (local
127.0.0.1→ 250ms). - Not a forge version mismatch — pinned
v1.7.1matches local, where the deploy runs in ~1s and the test is 12/12 green.
Why it doesn't reproduce locally
On a fast, uncontended machine with warm artifacts the deploy never stalls (12/12 passes at ~5s). The flake needs the contended CI runner — it is genuinely timing/external-tool-dependent.
Contributing factor
The anvil-e2e job has no timeout-minutes. Nothing bounds a hang except an unrelated cancel-in-progress from a later push; with no new push, a hung run would sit until GitHub's 6-hour default.
Proposed fix (smallest-first)
- CI guard rail — add
timeout-minutes: 15to theanvil-e2ejob so a hang fails red quickly instead of squatting a runner / masquerading as "cancelled". - Bound the
forgesubprocesses — runforge build/forge scriptviatokio::process::Command+tokio::time::timeout, kill the child on timeout, and retry the deploy 2–3×. Converts a rare forge stall into a brief retry instead of an unbounded hang. (Core fix.) - Optional defense-in-depth — wrap the whole test body in an overall
tokio::time::timeoutso any future unbounded await (iroh,get_receipt) fails fast with a clear message.
References
- Test:
crates/node/tests/anvil_settlement_e2e.rs(run_deploy_script, ~L869; initialforge build, ~L246) - CI job:
.github/workflows/ci.ymlanvil-e2e(~L447) - Related: test(node): anvil e2e harness for on-chain PaymentChannel settlement #745, incentive: watcher bring-up race — bootstrap returns before .watch() filters install, dropping events in the gap #762
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
github-actions commentedon Jun 2, 2026
🎯 Triage report
The
anvil-e2eCI job hangs 8–13 minutes whenforge script --broadcaststalls under contended CI runners, becauserun_deploy_scriptcallsstd::process::Command::output()with no timeout. The job also lacks atimeout-minutesguard, so a hung run can squander a runner until GitHub's 6-hour ceiling or acancel-in-progressintervenes — making it look "cancelled" rather than red. The reporter has already isolated the root cause with two concrete evidence runs and provides a clear 3-step fix.📊 Assessment
bug,testing,github_actions,highhighpriority because flakes silently waste runner time and obscure real failures🔗 Similar issues
💡 Notes and suggestions
Suggested implementation order (smallest blast radius first):
.github/workflows/ci.ymlanvil-e2ejob: addtimeout-minutes: 15. One-liner, zero Rust change, immediately makes hangs fail red.forgesubprocesses — incrates/node/tests/anvil_settlement_e2e.rs:std::process::Command::output()calls inrun_deploy_script(~L869) and the initialforge build(~L246) withtokio::process::Command+tokio::time::timeout(Duration::from_secs(60), ...).child.kill().await), retry up to 3×, then fail with a descriptive message.tokio::time::timeout(Duration::from_secs(120), async { ... })as defence-in-depth against any future unbounded await.Anti-panic policy note: any
unwrap()/expect()on the newtokio::processresult must become proper?propagation — the workspace deniesunwrap_usedandexpect_usedvia clippy.forge flake context:
forge script --broadcastreceipt-polling is known to stall under CPU contention; the retry-with-timeout pattern (fix 2) is the standard mitigation used in similar foundry-rs CI setups.Add this agentic workflows to your repo
To install this agentic workflow, run
test(node): bound flaky forge deploy in anvil-e2e with timeout + retry (
fix(node): retry forge DeployProtocol broadcast-phase non-zero exits (#…
test(e2e,ci): symmetric capture assert, document two deliberate choices
feat(e2e,client-pull): real daemon responses as on-chain slash eviden…
test(e2e): reset anvil state between deploy retries to de-flake journ…
fix: config single-source-of-truth doc + CI-aware anvil-e2e deploy ti…
fix(e2e): drain anvil's txpool before re-snapshotting between deploy …
ci: right-size the anvil-e2e timeout budgets (#1657)