Skip to content

test: log unexpected vitest worker exits and stop a cross-run kill - #272

Merged
ElbertePlinio merged 8 commits into
mainfrom
fix/253-worker-exits
Oct 6, 2026
Merged

ElbertePlinio merged 8 commits into
mainfrom
fix/253-worker-exits

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

This makes unexpected vitest worker exits diagnosable, and it fixes one confirmed cross-run kill.

Vitest reports a dead worker only as "Worker exited unexpectedly". The forks pool in test/worker-exit-pool.ts is vitest's own forks pool plus one stderr line when a worker exits outside vitest's shutdown. The line gives the time, worker pid, exit code, signal and test files. The only visible side effect is that vitest's error header names the pool forks-exit-logged.

The simulated cgroup test used the fixed token "b".repeat(64). Its marker sweep signals every process on the host that carries the token, so two concurrent runs of the file sent SIGTERM to each other's members. The token is now random per run.

Nine rounds of two concurrent full suites captured 12 worker exits. All 12 were SIGKILL with no exit code. Tracing ruled out OOM, systemd-oomd, vitest's own stop path, every kill() from Node, Bun or libc inside either suite, whole-group signals, cgroup.kill, fixed pids and pkill. The sender is still unknown. Finding it needs kernel signal tracing with root, so #253 stays open.

Refs #253

Requirement Verification Scenario Result Evidence
Capture the worker exit code or signal when it recurs Probe test plus concurrent full suites A test SIGKILLs its own worker; 9 rounds of two concurrent suites Logged "code none, signal SIGKILL" with pid and files; 12 real exits captured 253/logs/probe-exit-pool.log, 253/tally.txt
Fix or document the cause Paired runs, plus tracing to rule out causes Two concurrent runs of the sim test, 10 rounds Old fixed token 6/20 runs failed, random token 0/20; SIGKILL sender not found 253/sim-old-summary.txt, sim-new-summary.txt, 253/logs/
Lint, typecheck, PickCheck, full suite Automated Final head Pass, 2888 tests, thresholds met CI

Evidence lives in ~/Artifacts/pickforge-kickoff-2026-10-06/ on the dev host. The QA pass was skipped because this is test infrastructure with nothing to drive.

The marker sweep signals every host process that carries the scope
token. A fixed token let a concurrent run of this file kill the other
run's token-carrying members (#253).
Vitest reports a worker that dies outside its own shutdown only as
"Worker exited unexpectedly". A forks pool subclass now prints the
exit code, signal, pid and test files of such a worker (#253).
@ElbertePlinio
ElbertePlinio merged commit 8e639a6 into main Oct 6, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/253-worker-exits branch October 6, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant