任务 ID: task-0a208197  |  文件: session.md  |  最后修改: 2026-02-26 01:19:52

Session Log — task-0a208197 — OpenClaw Gateway Health Check Fact Check

时间: 2026-02-26 模式: search 轮次: 1


任务概述

对 5 条关于 OpenClaw gateway health check 机制的分析结论进行 fact check:
1. healthy = systemd status == "running" && 进程PID正在监听端口
2. 轮询参数:8次 × 450ms = 最多 3.6 秒超时
3. Stale PID 处理:检测到旧进程残留会自动 kill 再重试一次
4. Health check 失败原因:端口被 stale 进程占用,新进程绑不上端口,3.6秒内超时
5. 结论:残留进程已清理,正常重启后等几秒就好,不需要特别处理


Round 1 — 广度搜索结果

查询词:
- "OpenClaw gateway health check systemd port"
- "openclaw gateway restart stale process kill retry port occupied"
- "openclaw gateway health check poll interval milliseconds retries"
- "redsocks socat port occupied gateway restart linux"

关键来源:
- GitHub Issue #24279: MainPID vs child PID mismatch in health check (源码级分析)
- GitHub Issue #25195: 同一问题的 macOS 复现报告
- GitHub Issue #8069: orphan process 导致端口冲突
- CHANGELOG 2026.2.23: Gateway/Restart fix (#24696) - 已修复 child PID 问题
- 源码 restart-health.ts: 直接读取到实际参数

关键发现摘要

结论1(判断逻辑): 源码确认 healthy = running && ownsPort,但 ownsPort 检查的是父子进程树(修复后),非精确PID匹配
结论2(轮询参数): 源码实际值 120次×500ms=60秒,与「8次×450ms=3.6秒」严重不符
结论3(stale PID): 有支撑,SIGTERM→400ms→SIGKILL,再重启一次
结论4(失败原因): 端口占用机制有支撑;redsocks/socat归因无外部资料;超时时间有误
结论5(已清理可重启): 有支撑,CHANGELOG #24696 修复已合并

完成时间: 2026-02-26 有效来源: 8 条