You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ant-devnet: handle SIGTERM and use a per-run data dir by default #261
ant-devnet still leaves state behind when it is stopped with SIGTERM, which is how process managers and ant dev stop stop it. This is the remainder of WithAutonomi/ant-sdk#73.
Already fixed on main: the Anvil Testnet is now kept alive until main exits (local_testnet: Option<evmlib::testnet::Testnet>) instead of std::mem::forget, so its Drop runs on a normal exit.
Still open in src/bin/ant-devnet/main.rs:
Only SIGINT is handled. The binary waits on tokio::signal::ctrl_c(). On SIGTERM the process dies without calling devnet.shutdown(), so cleanup_data_dir is never honoured and the Anvil child is not dropped.
The default data dir is shared across runs.DevnetConfig::default() uses default_root_dir() (~/.local/share/ant/ on Linux). An interrupted run leaves partial node identities there for the next run to trip over.
Proposed fix
Wait on SIGINT or SIGTERM (tokio::signal::unix::signal(SignalKind::terminate()) on Unix, ctrl_c elsewhere) before calling devnet.shutdown().await.
When --data-dir is not given, use a fresh per-run directory (tempfile::TempDir or temp_dir().join("ant_devnet_{rand}")). The manifest already records the paths, so consumers can still find them. This matches tests/e2e/testnet.rs and ant-core's MiniTestnet.
Once this lands, ant-sdk's ant dev stop band-aid (force-kill plus wiping ~/.local/share/ant/{nodes,spill}, from ant-sdk#81) can be reduced.
Cross-link: Linear V2-1777 tracks the SIGTERM half of this issue: anvil is left running when ant-devnet is stopped with SIGTERM.
Where it came from: it was seen again on a 2026-10-29 devnet run with ant-node v0.23.1 (--preset default --enable-evm). After kill <pid>, the anvil -p 0 it spawned kept running and kept listening on the RPC port.
What V2-1777 adds:
kill_on_drop on the anvil process handle;
PR_SET_PDEATHSIG on Linux, so anvil also exits if ant-devnet is SIGKILLed.
A PR that fixes this issue should close V2-1777 as well. The original report is WithAutonomi/ant-sdk#73.
Activity
Nic-dorman commentedon Nov 2, 2026
Cross-link: Linear V2-1777 tracks the SIGTERM half of this issue: anvil is left running when ant-devnet is stopped with SIGTERM.
--preset default --enable-evm). Afterkill <pid>, theanvil -p 0it spawned kept running and kept listening on the RPC port.kill_on_dropon the anvil process handle;PR_SET_PDEATHSIGon Linux, so anvil also exits if ant-devnet is SIGKILLed.A PR that fixes this issue should close V2-1777 as well. The original report is WithAutonomi/ant-sdk#73.