fuzz lane: campaign finished
exit_code: -9
classified: compile/setup error
Three lines. The third one is wrong, and it cost me most of a day.
I run several audits at once on one workstation. Each audit has its own sessions, its own harnesses and its own long fuzz campaigns. That setup is efficient right up until two of those sessions touch the same process table without knowing about each other.
This is the story of one bad label, the rule I wrote after it, and the two times that rule itself broke on me in ways I did not expect. If you run fuzzers, CI jobs or test suites on a machine you share with anything else, including your own other projects, every part of it applies to you.
One of my audit sessions had a few stale fuzzers left over from an earlier run. It wanted them gone, so it did what almost every engineer has typed at some point:
pkill -9 -f "forge test --root"
-f matches against the full command line. forge test --root is not a name for my fuzzers. It is a name for every Foundry invariant campaign on the machine. Another audit had started a deep-tier harness campaign 43 seconds earlier. The pattern matched it, and SIGKILL took it down mid-run.
So far this is an ordinary mistake. A pattern kill on a shared host killed something it should not have. Annoying, cheap to recover from: restart the campaign, lose an hour of compute.
The expensive part came next.
The fuzz lane that had launched the campaign saw the process exit. It read the exit code, -9, and filed the run under its only catch-all bucket for a run that did not finish:
exit_code -9 (compile/setup error)
Every session that read that record afterwards believed it. A compile or setup error means the harness is broken. So the next hours went into fixing the harness: reading setup functions, checking imports, re-checking deployment order in setUp(), and finally deleting test contracts that looked suspicious, to see whether the error went away.
The harness was fine. It had always been fine. Nothing I deleted was broken.
What made this hard to see is that every individual step was reasonable. If a run fails with a compile error, you look at the code. If the code looks fine, you simplify it until the error moves. That is good debugging. It is also completely useless when the premise is false, and the premise came from a label that nobody questioned because a machine wrote it.
The kill cost an hour. The label cost a day.
On POSIX systems, a process killed by a signal does not have a normal exit status. Python's subprocess reports that as a negative return code: -N means "terminated by signal N".
Return code | Meaning | Who usually sent it |
|---|---|---|
|
|
|
|
| a timeout wrapper, a supervisor, |
|
| Ctrl-C, or a tool forwarding it |
|
| the process aborted itself (assertion, |
|
| the process crashed on a bad memory access |
Shells report the same event differently, as 128 + N, so 137 is a SIGKILL and 143 is a SIGTERM when you see them in CI logs.
Read the table again with one question in mind: which of these can a compile error produce? None of them. A compiler that fails exits with a small positive code, and it does so after printing an error. A -9 with no compiler output is not the harness talking. It is something outside the process ending it.
The rule I wrote down that evening is one sentence, and every one of my hunt prompts now carries it:
A negative exit code is
killed by signal N. Establish who sent the signal before you touch the code.
For -9 the usual suspects are a pattern kill, an OOM kill (check dmesg or the system journal for the OOM killer's line) or a supervisor that escalated after SIGTERM was ignored. For -15 it is almost always a timeout somewhere above you. None of those is fixed by editing a test.
The cause of the kill was a pattern. The fix is to stop needing one.
NEVER INSTEAD
pkill -f "forge test --root" stop <audit-id> (kills the recorded PID)
killall forge status / list (what is mine, what is live)
kill $(pgrep -f fuzz) capture $! at launch, kill that
Every long campaign now starts through one small launcher with four verbs: start <audit> <harness-dir>, stop <audit>, status, list. On start it:
launches the campaign in its own session (
start_new_session), so the campaign and its children form one process group;writes a pidfile per audit, recording the PID and the process's start time;
on
stop, re-reads the live process's start time and signals only if it still matches the record.
The start-time check matters more than it looks. PIDs are recycled. A pidfile that outlives its process can point at an unrelated process that later received the same number. Matching the kernel's start time ties the record to one specific process lifetime, so a stale pidfile can never make you kill a stranger. The launcher also signals only the session leader's group, checks the user ID, and never unlinks its lock file (an unlinked lock lets a second launcher create a new one at the same path and believe it holds it alone).
Before reaping anything by hand, I list what is live and match on my own absolute harness path, never a shared fragment like forge or python:
# POSIX
ps -eo pid,lstart,args | grep -F "$HARNESS_ROOT_ABSOLUTE"
# Windows
Get-CimInstance Win32_Process |
Where-Object { $_.CommandLine -like "*$HarnessRootAbsolute*" } |
Select-Object ProcessId, CreationDate, CommandLine
And if I do disturb another audit's process, that is reported as a cross-audit integrity event, out loud, the moment I notice. Not a silent retry. A silent retry hides the interference, and the cause keeps firing.
That should have been the end of the story. It was not.
A few weeks later, a review of my own tooling found this:
lane deep-tier timeout: 7,200 s
launcher timeout: 3,600 s
The fuzz lane gave a deep campaign two hours. The launcher wrapped it with a one-hour timeout. Any campaign sized for more than an hour was terminated at exactly 3,600 seconds with SIGTERM, and finished with exit -15.
The good news: the lane labelled it correctly this time. "Killed by signal 15." The rule worked.
The bad news: a correct label only tells you that something killed the process, not who. Sessions still lost hours asking which neighbour had done it this time. The answer was the launcher I had written to stop neighbours killing campaigns. The safety tool was the killer.
Worse, the documented example configuration for a "working template" harness, at the call rate I had measured on a similar target, worked out to roughly 9,300 seconds of fuzzing. Copying the recommended template produced a campaign that could not finish under either timeout. My own documentation was manufacturing the incident it was written to prevent.
Two lessons came out of this, and neither is about signals:
A timeout is a policy. When two layers each carry one, the smaller wins silently, and the larger one is a comment. Put the number in one place and have every layer read it.
"Who killed it" needs a journal, not a guess. The launcher now records its own terminations in the campaign record. If the supervisor sends the signal, the supervisor says so.
When I moved the workspace to a Windows host, the launcher came along. Its tests passed. Its start | stop | status | list interface looked identical.
A reviewer on the port found that on Windows the PID-ownership control did not function at all, for three separate reasons:
The function that reads a process's identity (PID plus start time) had Linux and macOS branches and nothing else. On Windows it returned
None. So "is this process still mine?" was always false, and the step that registers the launcher's own identity always raised.The launcher watched the child's output with
select.select()on a pipe. On Windows,selectonly accepts sockets, so it raisedWinError 10093before any campaign ran.The Windows backend dropped the
on_startcallback, which is what writes the pidfile. Sostartnever recorded anything tostoplater.
Think about what that does to a person under pressure. The safe tool refuses to work. There is no pidfile to stop by. The campaign is still running, it is eating CPU, and it needs to go. An operator with no owned handle reaches for a pattern. The port had quietly removed the exact control that stopped the original incident, and put the operator back one keystroke from pkill.
The fix was mechanical: read the process creation time through the Windows API, replace select with a reader thread, forward the callback. The lesson was not mechanical, and it has bitten me twice in the same port. An earlier change in the same backend had skipped an allowlist check that stops arbitrary environment variables (credentials included) being smuggled into a campaign. The check lived inline in the original path, and the new Windows branch was inserted before it.
Same shape both times: a shared contract implemented inside one backend branch, silently missing from the other. When you add a second backend, list every guarantee the first path gave, and for each one either hoist it above the branch or forward it explicitly. Do not trust the tests to find them. The tests for the original path pass on the new one because they never exercise the new one.
There is still one honest gap, and I would rather say it than round it up. The Windows path reaps by recorded PID with taskkill /PID <pid> /T /F, but it does not yet cross-check the start time the way the POSIX path does. The window is short and it is still PID ownership, never a pattern, but it is weaker, and the record says so.
Signals are not the only way an exit code misleads you. On the Rust side of my tooling I found the mirror image of the original incident.
cargo test exits with code 101 when a test fails. It also exits with 101 when the crate does not compile. My classifier accepted only 0 and 1 as normal test outcomes, so a Rust harness that had found a real invariant violation was journaled as:
exit_code 101 (compile/setup or unexpected failure)
and its parsed failures were thrown away. The lane was structurally unable to report a success, which in fuzzing means a failing invariant. No amount of careful harness authoring would ever have produced a green receipt.
The fix was to stop having one global table of what exit codes mean. Each backend now owns its exit classification, because each tool means something different by the same number. Then it parses the output to tell "a test failed" from "nothing compiled", instead of guessing from the code alone.
BEFORE YOU TRUST A "FAILED" RUN [2 minutes]
[ ] Exit code read with its sign. Negative (or 128+N in a shell) = signal N.
[ ] For a signal: who sent it? Pattern kill, OOM line in the kernel log,
a timeout wrapper, a supervisor? Check before opening the code.
[ ] Duration checked against every timeout above the process.
A run that died at exactly 3,600 s was not killed by a bug.
[ ] Tool-specific codes looked up for THIS tool (cargo 101, pytest 5, etc.).
[ ] Compiler output present? A "compile error" with no compiler message is not one.
BEFORE YOU KILL ANYTHING ON A SHARED HOST
[ ] Listed what is live, matched on my own absolute path, not a fragment.
[ ] Killing by recorded PID, with identity (start time) checked.
[ ] If something that wasn't mine died: said so immediately, no silent retry.
Not every negative code is someone else's fault.
-6and-11come from the process itself: an abort or a crash. Those do point at the code, just not at a compile step.PID ownership cannot protect you from the kernel. The OOM killer does not read pidfiles. If campaigns keep dying with
-9and nobody sent it, look at memory, and at how many deep campaigns you run at once.This is about one workstation. In real CI you get containers and job isolation, and much of this goes away. Plenty of independent hunters, me included, do not work in real CI. The work happens on one machine with five terminals open.
The labels came from my own tooling. I am not claiming any particular fuzzer mislabels signals. The point is that whatever turns a process exit into a word, yours included, deserves the same suspicion as any other input.
Grep your scripts, Makefiles and agent prompts for pkill -f, killall and kill $(pgrep. Each match is a loaded gun pointed at whatever else runs on your machine. Replace it with a PID you captured at launch.
Then find the place where your tooling turns an exit code into a word like "failed", "error" or "compile". Make sure it knows the difference between a process that exited and a process that was ended.
The harness I deleted pieces of that day was correct. The process table was the bug, and the label hid it.
Read the sign before you read the code.

