Skip to content

Unhandled error on detached spawned gateway process crashes the Node process #101458

Description

@aniruddhaadak80

Description:
In src/infra/process-respawn.ts, the spawnDetachedGatewayProcess function uses child_process.spawn() to start a detached process (lines 51-57). However, the child object is unref'd without attaching an error listener. If spawn fails asynchronously (e.g., due to ENOMEM or the executable being missing), the ChildProcess instance emits an error event. Because there is no error listener attached, Node.js treats it as an unhandled exception and crashes the parent process.

Impact:
Process crash on spawn failure, potential DoS.

File Links:

Proposed Fix:
Attach a .on(error, () => {}) handler to the spawned child before calling child.unref(), or handle the error properly by rejecting if it's wrapped in a promise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions