Repository navigation
Description
Summary
Processes started via @effect/platform's Command API remain alive after the parent Effect program receives SIGINT. When the wrapper exits, the child continues running (PPID=1) and keeps its TCP port bound. This happens on both Node and Bun with current @effect/platform-node releases.
Minimal Reproduction
Steps:
pnpm installpnpm start- Wait for
[child] listening on http://127.0.0.1:48787 pid=… - Press
Ctrl+C lsof -nP -iTCP:48787 -sTCP:LISTEN
Actual output after SIGINT:
[child] listening on http://127.0.0.1:60091 pid=3231873
wrapper pid=3231753 pgid=?
Child process tree (pid=3231873):
PID PPID PGID COMMAND
3231873 1 3231873 node child.mjs
Wrapper exited. Checking listeners...
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
MainThrea 3231873 schickling 53u IPv6 … TCP *:60091 (LISTEN)
The wrapper (index.mjs) builds the command via Command.make("bash", "-lc", "setsid node child.mjs") and provides NodeContext, NodeFileSystem, and NodeCommandExecutor layers. The child enables SIGINT handling, but because the parent exits immediately, the child becomes an orphan and keeps serving traffic.
Expected
Child process should be terminated (or the process group cleaned up) when the parent program receives SIGINT.
Actual
The parent exits immediately; the detached child keeps running with PPID=1, leaving its port bound.
Additional Context
- Reproduced on Bun 1.2.22 and Node 24.8.0 with
[email protected],@effect/[email protected]. - In a larger CLI we saw the same behaviour: Wrangler, Vite, and workerd processes all stayed alive after Ctrl+C (
tmp/cfchat-process-leak/run-20250930-171635.log). @effect/platform-node-shared/internal/commandExecutorruns commands withdetached: true. The release handler only kills the group when the exit code is non-zero; signal exits (code === null,signal !== null) skip cleanup.
Proposal
Update the release handler to kill the process group when a command terminates because of a signal (e.g. code === null && signal !== null). That would ensure detached groups are cleaned up after SIGINT.
Activity
schickling commentedon Oct 1, 2025
Turns out this was about bash swallowing sigint signals, which unfortunately happens to be the behavior of bash and we can do nothing about it.