Repository navigation
fix(server): starting processes on Linux no longer freezes the server again - #295
Merged
Merged
Conversation
… again The upstream sync deleted SpawnHost, assuming upstream's NonBlockingSpawner replaced it. It does not: on Linux with GNU env -C, upstream still calls child_process.spawn on the main thread, and Node's libuv 1.52 forks there, copying the server's page tables. On the mini PC spawning took 75% of the main thread and the event loop stalled 2-6 s at a time. SpawnWorker.layerServer now picks SpawnHost on that branch. NonBlockingSpawner still wraps it, so hung-mount checks stay off the main thread too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosNo All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the upstream sync (#294), the mini PC's server stalls for 2–6 s at a time, about a minute of every hour. A 45 s CPU profile of the live server showed 75% of the main thread inside
child_process.spawn. The stall log agrees: per 30 s, 10.5 s of system CPU and about 630k minor page faults. Before the sync it was 2–3 s and 125–166k. The server starts about 30 processes a second (git, tar, gzip, claude). Node 24.22 bundles libuv 1.52, which forks each one on the main thread and copies the 7 GB server's page tables every time.#294 deleted the fork's
SpawnHost(#269) because upstream's pingdotgg#30209 looked like it covered this. It doesn't.NonBlockingSpawneronly moves the chdir and PATH checks off the main thread. On Linux with GNUenv -C,SpawnWorker.layerServerstill hands spawning to Node's own spawner on the main thread.The fix restores
SpawnHost, its host process, the__spawn-hostentry and the process-metrics grouping, all unchanged from before the sync.SpawnWorker.layerServernow returnsSpawnHost.layeron that branch.NonBlockingSpawnerstill wraps it, so hung-mount protection stays.SpawnHost.layeris Node's spawner everywhere except Linux before libuv 1.53, so macOS doesn't change and Windows keeps its workers.Verification: typecheck, lint, format and knip pass. The
SpawnHosttests only run on Linux, so CI runs them. On a Mac,SpawnWorker.test.tsfails one case on/private/varvs/var, which is unrelated to this change. After it deploys, I'll re-profile the mini PC and compare the stall log.Follow-ups (both pre-existing in
SpawnHostbefore #294, found by the independent review):shell-with-args checks before handing a command to the host, so those fail asbadArgumentinstead of a defect or a silently different command.spawnargserror cause, as upstream's spawner does.Model: Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code