-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug] SIGUSR1 restart on Windows creates orphaned process when running as Scheduled Task #23509
Description
Summary
When the gateway runs as a Windows Scheduled Task and receives SIGUSR1 (via config.patch or gateway restart), it spawns a new child process and the original exits. The Scheduled Task sees the original process exit and considers the job complete, leaving the child process orphaned and unmanaged. When that child eventually crashes or is killed, the gateway stays down permanently until manually restarted.
Steps to Reproduce
- Install OpenClaw on Windows with gateway registered as a Scheduled Task (login trigger)
- Trigger a
config.patchorgateway restart(sends SIGUSR1) - Gateway logs:
received SIGUSR1; restarting→restart mode: full process restart (spawned pid XXXX) - Original process exits → Scheduled Task marks job as complete
- Spawned child runs but is unmanaged
- If child dies, gateway never comes back
Expected Behavior
Gateway should restart reliably under Windows Scheduled Task supervision.
Actual Behavior
From the logs:
2026-02-22T07:22:15.342Z | signal SIGUSR1 received
2026-02-22T07:22:15.346Z | received SIGUSR1; restarting
2026-02-22T07:22:15.450Z | feishu[feishu1]: abort signal received, stopping
2026-02-22T07:22:15.473Z | event shutdown
2026-02-22T07:22:17.615Z | signal SIGUSR1 received (second signal during shutdown, ignored)
2026-02-22T07:22:45.516Z | restart mode: full process restart (spawned pid 10096)
The spawned child (pid 10096) runs fine temporarily but is not supervised by the Scheduled Task. The task's last result shows a failure code (-2147023829).
Suggested Fix
On Windows with Scheduled Task service mode, instead of spawning a detached child process, the restart could:
- Re-trigger the scheduled task via
schtasks /run /tn "OpenClaw Gateway" - Or use a wrapper/watchdog pattern that keeps the original process as supervisor
Environment
- OS: Windows 10 (10.0.19045)
- Node: v24.13.0
- OpenClaw: 2026.2.17
- Service: Windows Scheduled Task (login trigger)
- Gateway cmd:
gateway.cmdgenerated by onboarding