Skip to content

[Bug]: Gateway child process not terminated on parent SIGINT/SIGTERM — zombie orphans accumulate #18420

@bbartelt-aha

Description

@bbartelt-aha

Summary

When the parent openclaw process receives SIGINT (Ctrl+C) or SIGTERM (e.g., closing the terminal), it does not forward the signal to its openclaw-gateway child process. The gateway keeps running as an orphan, and ignores subsequent SIGTERM — requiring kill -9.

Steps to reproduce

  1. Start openclaw gateway start in a terminal
  2. Hit Ctrl+C or close the terminal
  3. Run ps aux | grep openclaw-gateway — the gateway is still running with TTY ??
  4. Repeat steps 1-3 a few times over normal usage
  5. Observe multiple zombie gateway processes accumulating

Expected behavior

When the parent openclaw process exits for any reason, it should:

  1. Forward SIGINT/SIGTERM to the openclaw-gateway child
  2. Wait briefly for graceful shutdown
  3. SIGKILL the child if it doesn't exit within a timeout

The gateway itself should also handle SIGTERM gracefully rather than ignoring it.

Actual behavior

Over 3 days of normal usage (restarts, Ctrl+C, terminal closes), 6 zombie gateway processes accumulated from Friday Feb 13, all detached from any terminal:

PID    PPID   STAT TTY  STARTED                COMMAND
8819   8818   S    ??   Fri Feb 13 16:23:01    openclaw-gateway
9386   1      S    ??   Fri Feb 13 16:25:32    openclaw-gateway (orphaned to init)
9982   9980   S    ??   Fri Feb 13 16:29:52    openclaw-gateway
10366  10364  S    ??   Fri Feb 13 16:30:30    openclaw-gateway
10634  10632  S    ??   Fri Feb 13 16:31:06    openclaw-gateway
21690  21689  S    ??   Fri Feb 13 17:32:26    openclaw-gateway

All ignored kill <pid> (SIGTERM) and required kill -9 to terminate.

OpenClaw version

2026.2.12

Operating system

macOS 15 (Darwin 24.6.0, arm64) — Mac mini M4

Install method

npm global (nvm, Node v24.11.1)

Logs, screenshots, and evidence

Impact and severity

Affected: Any user running openclaw gateway from a terminal
Severity: Medium — zombie processes consume memory and can cause port conflicts on restart
Frequency: 100% repro — every Ctrl+C or terminal close leaves an orphan
Consequence: Stale gateway processes accumulate silently; users must manually kill -9 them. Over days this can consume significant memory (each gateway ~300-500MB RSS).

Additional information

The parent openclaw process spawns openclaw-gateway as a child but does not set up signal forwarding. When the parent receives SIGINT/SIGTERM, it exits without killing the child, which gets reparented to PID 1 (or stays attached to the dead parent). The gateway child also appears to ignore SIGTERM entirely, requiring SIGKILL.

Suggested fix: register SIGINT/SIGTERM handlers in the parent that forward to the child process group, with a timeout fallback to SIGKILL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions