Fixes BIT-31194 — Error Loop crash: write EPIPE at apps/api/src/lib/line-process.ts:80.
LineProcess.request() writes JSON requests to the worker child process stdin. When the worker dies mid-request, the write can race the exit handler and hit the pipe after it already broke, raising EPIPE. With no error listener on child.stdin, that was an unhandled stream error that crashed the whole API process.
Fix: attach a no-op error listener on child.stdin right after spawn. The existing exit handler already rejects any pending requests for that worker, so callers still get a clean rejection instead of a process crash.
Verified with a standalone repro (200 rapid spawn+write races against short-lived children): crashes reliably with write EPIPE without the listener, survives cleanly with it. tsc --noEmit shows no new errors (38 pre-existing unrelated errors on main, none in this file).
Fixes BIT-31194 — Error Loop crash: `write EPIPE` at `apps/api/src/lib/line-process.ts:80`.
`LineProcess.request()` writes JSON requests to the worker child process stdin. When the worker dies mid-request, the write can race the `exit` handler and hit the pipe after it already broke, raising EPIPE. With no `error` listener on `child.stdin`, that was an unhandled stream error that crashed the whole API process.
Fix: attach a no-op `error` listener on `child.stdin` right after spawn. The existing `exit` handler already rejects any pending requests for that worker, so callers still get a clean rejection instead of a process crash.
Verified with a standalone repro (200 rapid spawn+write races against short-lived children): crashes reliably with `write EPIPE` without the listener, survives cleanly with it. `tsc --noEmit` shows no new errors (38 pre-existing unrelated errors on main, none in this file).
LineProcess.request() writes JSON requests to the worker child process stdin
(line-process.ts:80). When the worker dies mid-request the write can race the
exit handler and hit the pipe after it's already broken, raising EPIPE. With
no "error" listener on child.stdin, that EPIPE was an unhandled stream error
and crashed the whole API process. Attach a no-op error listener on stdin;
the existing "exit" handler already rejects any pending requests for that
worker, so callers still see a clean rejection instead of a process crash.
Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-31194
Paperclip-Run: de3027ac-866e-4c9d-919b-6f21ff532c3d
spark
scheduled this pull request to auto merge when all checks succeed 2026-10-15 06:26:46 +01:00
spark
merged commit 0736d34f4d into main2026-10-15 06:26:47 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes BIT-31194 — Error Loop crash:
write EPIPEatapps/api/src/lib/line-process.ts:80.LineProcess.request()writes JSON requests to the worker child process stdin. When the worker dies mid-request, the write can race theexithandler and hit the pipe after it already broke, raising EPIPE. With noerrorlistener onchild.stdin, that was an unhandled stream error that crashed the whole API process.Fix: attach a no-op
errorlistener onchild.stdinright after spawn. The existingexithandler already rejects any pending requests for that worker, so callers still get a clean rejection instead of a process crash.Verified with a standalone repro (200 rapid spawn+write races against short-lived children): crashes reliably with
write EPIPEwithout the listener, survives cleanly with it.tsc --noEmitshows no new errors (38 pre-existing unrelated errors on main, none in this file).