最近在跟着小龙虾的热度,准备自己养一只小龙虾,奈何搭建是很简单,但是想要养活可不容易,我是装了卸,卸了装,都差点要放弃养虾了。直到我找到了我的龙虾无故死去的原因。
问题现象
使用飞书、qq、微信这样的对话channel,总是聊不到1个回合,就不搭理你了,这就会导致你不停重启网关、看网关状态、看日志,你会发现网关大部分情况下都是连接timeout。
重试命令
# 查看网关状态
openclaw gateway status
# 重启网关
openclaw gateway restart
# 查看运行日志
openclaw logs --follow
日志情况
openclaw logs --follow
🦞 OpenClaw 2026.3.13 (61d171a) — Your second brain, except this one actually remembers where you left things.
17:41:14 [plugins] feishu_doc: Registered feishu_doc, feishu_app_scopes
17:41:14 [plugins] feishu_chat: Registered feishu_chat tool
17:41:14 [plugins] feishu_wiki: Registered feishu_wiki tool
17:41:14 [plugins] feishu_drive: Registered feishu_drive tool
17:41:14 [plugins] feishu_bitable: Registered bitable tools
gateway connect failed: Error: gateway closed (1000):
Gateway not reachable. Is it running and accessible?
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /root/.openclaw/openclaw.json
Bind: loopback
Hint: run openclaw doctor.
---
Log tail truncated (increase --max-bytes).
02:31:51 info gateway {"subsystem":"gateway"} signal SIGTERM received
02:31:51 info gateway {"subsystem":"gateway"} received SIGTERM; shutting down
02:31:51 error [tools] exec failed: Command aborted by signal SIGTERM
02:31:51 error [tools] exec failed: Command aborted by signal SIGTERM
02:31:51 info gateway/channels/feishu {"subsystem":"gateway/channels/feishu"} feishu[default]: abort signal received, stopping
Gateway not reachable. Is it running and accessible?
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: /root/.openclaw/openclaw.json
Bind: loopback
Hint: run openclaw doctor.
问题原因
OC的cli执行命令都需要加载安装的插件,插件安装的多的话,导致 WebSocket 握手超时,代码里写死了3s的硬编码超时机制,相关issue:
解决办法
很直接,把超时时间改大,等着官方更新代码修复,如果官方没有修复,那就一直改下去,在你追新版更新的情况下,因为每次安装会覆盖修改的文件。
修改命令:配置文件的路径可能根据每个人安装目录不同,需要相应修改:
sed -i 's/const DEFAULT_HANDSHAKE_TIMEOUT_MS = 3e3;/const DEFAULT_HANDSHAKE_TIMEOUT_MS = 15e3;/' /usr/lib/node_modules/openclaw/dist/gateway-cli-*.js
openclaw gateway restart
这里我改为了15e3,也就是15s,你也可以改为9s,也就是9e3。
其他问题
局域网部署的openclaw打不开ui:
获取带本地回环地址token的url:
openclaw dashboard --no-open
修改配置文件:
vim /root/.openclaw/openclaw.json
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"allowedOrigins": [
"http://localhost:18789",
"http://127.0.0.1:18789",
"http://自己的局域网IP:18789"
],
"allowInsecureAuth": true,
"dangerouslyDisableDeviceAuth": true
},
对照着自己的龙虾配置文件进行修改就行了。
0