Summary
The gateway service spawns a duplicate openclaw-gateway subprocess that persists after the main service restarts, causing port 18789 conflicts and infinite restart loops.
Environment
- openclaw version: 2026.2.1
- OS: Ubuntu (Linux 6.14.0-37-generic)
- Node.js: 22.x
- Service manager: systemd (user service)
Steps to Reproduce
- Run gateway via systemd user service (
clawdbot-gateway.service)
- Service runs normally for some time
- At some point, an orphan
openclaw-gateway process gets spawned
- If systemd restarts the service, the orphan holds port 18789
- New service instance fails with "Port 18789 is already in use"
- Restart loop continues indefinitely
Observed Behavior
Process tree shows duplicate gateway processes:
clawdbot (systemd-managed, pid 821565)
├── clawdbot-gateway (correct child, pid 821573)
└── openclaw-gateway (orphan subprocess, pid 822412)
The orphan is spawned via node:
/usr/bin/node /home/user/.npm-global/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Journal shows the restart loop:
Gateway failed to start: another gateway instance is already listening on ws://127.0.0.1:18789
Port 18789 is already in use.
- pid 640043 rich: openclaw-gateway (127.0.0.1:18789)
The systemd restart counter reached 3334 before manual intervention.
Expected Behavior
- Only one gateway process should exist at a time
- Child processes should be properly managed and terminated when parent stops
- No orphan processes should persist after service restart
Impact
- Gateway becomes unavailable until manual intervention
- Health checks pass (orphan responds to HTTP) masking the issue
- Systemd restart loop wastes CPU cycles
- Users can't reach their messaging integrations
Workaround
Kill the orphan process manually:
# Find the orphan
ss -tlnp | grep 18789
# Kill it
kill <orphan_pid>
# Restart service
systemctl --user restart clawdbot-gateway
Possible Causes
The orphan may be spawned when:
clawdbot-gateway internally calls the CLI to spawn workers
- A subprocess escapes the process group during shutdown
- Signal handling doesn't propagate to all children
Related
This may be related to the clawdbot→openclaw rename/migration - the service file references clawdbot binaries but spawns openclaw-gateway subprocesses.
Summary
The gateway service spawns a duplicate
openclaw-gatewaysubprocess that persists after the main service restarts, causing port 18789 conflicts and infinite restart loops.Environment
Steps to Reproduce
clawdbot-gateway.service)openclaw-gatewayprocess gets spawnedObserved Behavior
Process tree shows duplicate gateway processes:
The orphan is spawned via node:
Journal shows the restart loop:
The systemd restart counter reached 3334 before manual intervention.
Expected Behavior
Impact
Workaround
Kill the orphan process manually:
Possible Causes
The orphan may be spawned when:
clawdbot-gatewayinternally calls the CLI to spawn workersRelated
This may be related to the clawdbot→openclaw rename/migration - the service file references
clawdbotbinaries but spawnsopenclaw-gatewaysubprocesses.