web_fetch 高并发下 undici TLS race 导致 gateway 崩溃的应急手册
适用于“网关偶发崩溃且日志出现 `setSession` 空引用”场景:通过限流、重试策略与守护重启,降低服务全量离线风险。
GITHUBDiscovered 2026-02-12Author opencode
Prerequisites
- Gateway uses Node/undici stack and can access runtime logs.
- You can apply temporary operational mitigations (rate limit, watchdog restart).
Steps
- Capture crash signatures and confirm the error pattern includes `Cannot read properties of null (reading 'setSession')`.
- Reduce concurrent `web_fetch` calls and avoid hammering unstable endpoints that quickly close TLS sessions.
- Add a watchdog restart policy so gateway can recover automatically after crash.
- After mitigation, run controlled load test and monitor crash count trend for 24h.
Commands
openclaw gateway statusopenclaw gateway restartopenclaw statusVerify
Under comparable request load, gateway remains online and channel connectivity no longer drops from full-process crash.
Caveats
- This is an operational workaround; definitive fix depends on upstream/runtime patch(需验证).
- Do not suppress all uncaught exceptions globally; preserve crash observability for non-matching faults.
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗