Skip to content

Bug: gateway stop doesn't terminate node.exe process on Windows #52049

@andyk-ms

Description

@andyk-ms

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 OK

Expected 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 /T for 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.cmd use start /wait so schtasks /End kills the whole tree

Workaround

Use taskkill /F /IM node.exe to force-kill the gateway, then openclaw gateway start.

Impact

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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