Description
SIGUSR1-triggered gateway restarts consistently crash on Windows 10 with an \EBADF: bad file descriptor, write\ error. The spawned child process inherits file descriptors from the parent that are already closed/invalid by the time it tries to write to stdout/console.
Steps to Reproduce
- Run OpenClaw gateway on Windows 10 (native, not WSL)
- Trigger a restart via \config.patch\ (which sends SIGUSR1 internally)
- The gateway receives the signal, spawns a new process, then the new process crashes
Expected Behavior
The gateway should restart cleanly via SIGUSR1, as it does on Linux/macOS.
Actual Behavior
The spawned child process immediately crashes:
\
[openclaw] Uncaught exception: Error: EBADF: bad file descriptor, write
at writeSync (node:fs:922:3)
at SyncWriteStream._write (node:internal/fs/sync_write_stream:27:5)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at Writable.write (node:internal/streams/writable:508:10)
at console.value (node:internal/console/constructor:298:16)
at console.log (node:internal/console/constructor:384:26)
at writeConsoleLine (file:///...openclaw/dist/subsystem-oVAQxyhr.js:403:32)
at emit (file:///...openclaw/dist/subsystem-oVAQxyhr.js:432:3)
at Object.info (file:///...openclaw/dist/subsystem-oVAQxyhr.js:453:28)
\\
The gateway log shows:
- \signal SIGUSR1 received\
eceived SIGUSR1; restarting\
estart mode: full process restart (spawned pid XXXXX)\
- \Uncaught exception: Error: EBADF: bad file descriptor, write\
The gateway does not come back up — manual restart is required.
Environment
- OS: Windows 10 (10.0.19045) x64
- Node: v24.6.0
- OpenClaw: v2026.2.17 (4134875)
- Gateway mode: local, bind: lan
- Auth: token mode (Claude Max OAuth)
Workaround
Manual restart via \openclaw gateway stop && openclaw gateway start\ or a PowerShell restart script.
Notes
This is 100% reproducible — every SIGUSR1 restart attempt on this Windows machine fails the same way. The issue appears to be that the spawned child process inherits stdio file descriptors from the dying parent, but on Windows these become invalid (EBADF) before the child can use them. On Unix this likely works because of different fd inheritance semantics.
Description
SIGUSR1-triggered gateway restarts consistently crash on Windows 10 with an \EBADF: bad file descriptor, write\ error. The spawned child process inherits file descriptors from the parent that are already closed/invalid by the time it tries to write to stdout/console.
Steps to Reproduce
Expected Behavior
The gateway should restart cleanly via SIGUSR1, as it does on Linux/macOS.
Actual Behavior
The spawned child process immediately crashes:
\
[openclaw] Uncaught exception: Error: EBADF: bad file descriptor, write
at writeSync (node:fs:922:3)
at SyncWriteStream._write (node:internal/fs/sync_write_stream:27:5)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at Writable.write (node:internal/streams/writable:508:10)
at console.value (node:internal/console/constructor:298:16)
at console.log (node:internal/console/constructor:384:26)
at writeConsoleLine (file:///...openclaw/dist/subsystem-oVAQxyhr.js:403:32)
at emit (file:///...openclaw/dist/subsystem-oVAQxyhr.js:432:3)
at Object.info (file:///...openclaw/dist/subsystem-oVAQxyhr.js:453:28)
\\
The gateway log shows:
eceived SIGUSR1; restarting\
estart mode: full process restart (spawned pid XXXXX)\
The gateway does not come back up — manual restart is required.
Environment
Workaround
Manual restart via \openclaw gateway stop && openclaw gateway start\ or a PowerShell restart script.
Notes
This is 100% reproducible — every SIGUSR1 restart attempt on this Windows machine fails the same way. The issue appears to be that the spawned child process inherits stdio file descriptors from the dying parent, but on Windows these become invalid (EBADF) before the child can use them. On Unix this likely works because of different fd inheritance semantics.