-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Bug: gateway stop doesn't terminate node.exe process on Windows #52049
Description
Bug: gateway stop doesn't terminate the node.exe process on Windows
Summary
openclaw gateway stop reports "Stopped Scheduled Task: OpenClaw Gateway" but the actual node.exe gateway process continues running. The gateway remains accessible on port 18789 after stop.
Root Cause
The "OpenClaw Gateway" scheduled task runs gateway.cmd, which in turn launches node.exe:
gateway.cmd → node.exe ... gateway --port 18789
openclaw gateway stop calls schtasks /End /TN "OpenClaw Gateway", which terminates gateway.cmd (the parent batch script) but does not kill the child node.exe process. The node process is detached/orphaned and keeps running.
Reproduction
# Start gateway
openclaw gateway start
# Confirm it's running
Get-NetTCPConnection -LocalPort 18789 -State Listen
# → Shows node.exe PID
# Stop gateway
openclaw gateway stop
# → "Stopped Scheduled Task: OpenClaw Gateway"
# Check again — node.exe is still running
Get-NetTCPConnection -LocalPort 18789 -State Listen
# → STILL shows node.exe PID (same PID as before)
# Gateway still responds
Invoke-WebRequest -Uri "http://127.0.0.1:18789/" -UseBasicParsing
# → 200 OKExpected Behavior
openclaw gateway stop should fully terminate the gateway process, not just the parent batch script. After stop, port 18789 should be free and the node.exe process should be gone.
Suggested Fix
Either:
- Use
taskkill /T /PID <pid>(with/Tfor tree kill) to terminate the entire process tree, OR - Send a graceful shutdown signal to node.exe directly (e.g., via the HTTP endpoint) before calling
schtasks /End, OR - Have
gateway.cmdusestart /waitsoschtasks /Endkills the whole tree
Workaround
Use taskkill /F /IM node.exe to force-kill the gateway, then openclaw gateway start.
Impact
openclaw gateway stopfollowed byopenclaw gateway startcreates a port conflict (old process still holds 18789)- This also contributes to the duplicate-window issue in
gateway restart(Bug: gateway restart spawns duplicate processes on Windows (3 windows) #52044) — the "stopped" process is still alive when the new one starts
Environment
- OpenClaw v2026.3.8
- Windows 10 (build 26200)
- Node.js v24.14.0
- Gateway managed via "OpenClaw Gateway" scheduled task
- Task action:
C:\Users\Dell\.openclaw\gateway.cmd