Skip to content

[Bug] SIGUSR1 restart on Windows creates orphaned process when running as Scheduled Task #23509

@Daniel-Myclaw

Description

@Daniel-Myclaw

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

  1. Install OpenClaw on Windows with gateway registered as a Scheduled Task (login trigger)
  2. Trigger a config.patch or gateway restart (sends SIGUSR1)
  3. Gateway logs: received SIGUSR1; restartingrestart mode: full process restart (spawned pid XXXX)
  4. Original process exits → Scheduled Task marks job as complete
  5. Spawned child runs but is unmanaged
  6. 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.cmd generated by onboarding

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked 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