




















@@ -454,6 +454,58 @@ Related:
454454- [Configuration](/gateway/configuration)
455455- [Doctor](/gateway/doctor)
456456457+## macOS gateway silently stops responding, then resumes when you touch the dashboard
458+459+Use this when channels (Telegram, WhatsApp, etc.) on a macOS host go quiet for minutes to hours at a time, and the gateway appears to come back the moment you open the Control UI, SSH in, or otherwise interact with the host. There is usually no obvious symptom in `openclaw status` because by the time you look the gateway is alive again.
460+461+```bash
462+ls ~/.openclaw/logs/stability/ | tail -5
463+openclaw gateway stability --bundle latest
464+pmset -g log | grep -iE "sleep|wake|maintenance" | tail -50
465+launchctl print gui/$UID/ai.openclaw.gateway | grep -E "state|last exit|runs"
466+```
467+468+Look for:
469+470+- One or more `*-uncaught_exception.json` bundles in `~/.openclaw/logs/stability/` with `error.code` set to a transient network code such as `ENETDOWN`, `ENETUNREACH`, `EHOSTUNREACH`, or `ECONNREFUSED`.
471+- `pmset -g log` lines like `Entering Sleep state due to 'Maintenance Sleep'` or `en0 driver is slow (msg: WillChangeState to 0)` aligned with the crash timestamps. Power Nap / Maintenance Sleep briefly puts the Wi-Fi driver into state 0; any outbound `connect()` that lands in that window can fail with `ENETDOWN` even on a host that otherwise has full network connectivity.
472+- `launchctl print` output showing `state = not running` with multiple recent `runs` and an exit code, especially when the gap between crash and the next launch is on the order of an hour rather than seconds. macOS launchd applies an undocumented respawn-protection gate after a crash burst that can stop honoring `KeepAlive=true` until an external trigger such as interactive login, dashboard connection, or `launchctl kickstart` re-arms it.
473+474+Common signatures:
475+476+- A stability bundle whose `error.code` is `ENETDOWN` or a sibling code, with the call stack pointing into Node `net` `lookupAndConnect` / `Socket.connect`. OpenClaw `2026.5.26` and newer classify these as benign transient network errors so they no longer propagate to the top-level uncaught handler; if you are on an older release, upgrade first.
477+- Long quiet periods that end the instant you connect to the Control UI or SSH into the host: the user-visible activity is what re-arms launchd's respawn gate, not anything the dashboard does to the gateway.
478+- `runs` count incrementing across the day with no corresponding `received SIG*; shutting down` line in `~/Library/Logs/openclaw/gateway.log`: clean shutdowns log a signal; transient crashes do not.
479+480+What to do:
481+482+1. **Upgrade the gateway** if you are running a release before `2026.5.26`. After upgrading, future `ENETDOWN` errors are logged as warnings instead of terminating the process.
483+2. **Reduce maintenance sleep activity** on Mac mini / desktop hosts that are meant to run as always-on servers:
484+485+```bash
486+ sudo pmset -a sleep 0 disksleep 0 standby 0 powernap 0
487+```
488+489+ This significantly reduces, but does not entirely eliminate, the underlying driver flap. The system can still perform some maintenance sleeps for TCP keepalive and mDNS upkeep regardless of these flags.
490+491+3. **Add a liveness watchdog** so a future crash burst that gets parked by launchd is caught quickly:
492+493+```bash
494+# Example launchd-aware liveness check, suitable for a 5-minute cron or LaunchAgent
495+ state=$(launchctl print gui/$UID/ai.openclaw.gateway 2>/dev/null | awk -F'= ' '/state =/ {print $2; exit}')
496+if [ "$state" != "running" ]; then
497+ launchctl kickstart -k gui/$UID/ai.openclaw.gateway
498+fi
499+```
500+501+ The point is to externally re-arm the respawn gate; `KeepAlive=true` alone is not sufficient on macOS after a crash burst.
502+503+Related:
504+505+- [macOS platform notes](/platforms/macos)
506+- [Logging](/logging)
507+- [Doctor](/gateway/doctor)
508+457509## Gateway exits during high memory use
458510459511Use this when the Gateway disappears under load, the supervisor reports an OOM-style restart, or logs mention `critical memory pressure bundle written`.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。