test(evm): cap child_process.exec in lib.js to surface stalled commands#3526
test(evm): cap child_process.exec in lib.js to surface stalled commands#3526wen-coding wants to merge 1 commit into
Conversation
The Autobahn EVM integration matrix has hit multiple 30-minute job timeouts where hardhat went silent between test files with no error. The orphan-process listing at cleanup consistently shows a docker exec (running `seid tx evm send` or similar) still alive — `child_process.exec` has no timeout by default, so a stalled CLI invocation eats the entire job budget instead of surfacing as a clear error. Add a default 60s timeout to execCommand with a SIGKILL kill signal. On expiry, throw an error containing the offending command so the next occurrence is a 60s actionable error instead of a 30-minute mystery. Override via EXEC_TIMEOUT_MS for tests that legitimately need longer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR SummaryLow Risk Overview On timeout, rejections use a dedicated message that includes the timeout and a truncated command string; other exec errors are unchanged. This affects every path that shells out through Reviewed by Cursor Bugbot for commit c9247d6. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c9247d6. Configure here.
| if (error.killed || error.signal) { | ||
| const summary = command.length > 200 ? command.slice(0, 197) + "..." : command | ||
| reject(new Error(`execCommand timed out after ${timeoutMs}ms: ${summary}`)) | ||
| return |
There was a problem hiding this comment.
Overly broad signal check misattributes non-timeout kills
Low Severity
The condition error.killed || error.signal catches any signal-terminated process, not just timeout kills. error.killed is only true when Node.js itself killed the process (i.e., the timeout fired), but error.signal is set for any signal death — including external OOM kills, CI runner resource-limit kills, or cleanup scripts. In those cases the rejection message incorrectly says "execCommand timed out after ${timeoutMs}ms", sending engineers looking for timeout causes when the actual issue is something else entirely. Since this PR's whole purpose is improving diagnostics, the condition could be narrowed to just error.killed to avoid misattribution.
Reviewed by Cursor Bugbot for commit c9247d6. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3526 +/- ##
==========================================
- Coverage 59.15% 58.30% -0.85%
==========================================
Files 2213 2140 -73
Lines 182710 174341 -8369
==========================================
- Hits 108077 101650 -6427
+ Misses 64930 63667 -1263
+ Partials 9703 9024 -679
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|


Summary
execCommandin contracts/test/lib.js wrapschild_process.execwith no timeout. The Autobahn EVM integration matrix has hit multiple 30‑minute job timeouts where the hardhat process went silent at a test boundary, with the orphan‑process listing at cleanup consistently showing a stalleddocker exec ... seid ...child still alive. The job then consumed its entire wall‑clock budget instead of surfacing a useful error.This caps
execCommandwith a configurable timeout (default 60s,SIGKILL). On expiry, the rejection includes the offending command so the next occurrence is a 60s actionable error instead of a 30‑minute mystery. Override viaEXEC_TIMEOUT_MSfor tests that legitimately need longer.Observed hang pattern (7 occurrences in 3 days)
Each ran for exactly ~30 minutes (job timeout). Investigation of one of the artifacts (26648905384): validators were perfectly healthy (continuing to produce blocks) the whole time, no test‑sender activity reached them during the silence — i.e., the hardhat process was alive but never sent another RPC, consistent with a stalled child process here.
Trade-off
docker execcalls in the suite complete in ~100–200ms; 60s is comfortably above the worst observed normal case.EXEC_TIMEOUT_MSoverrides per-invocation.Test plan
execCommand timed out … <command>error instead of a 30‑min cancel — that error itself becomes the diagnostic.🤖 Generated with Claude Code