Repository navigation
BUG: dsh web 空闲时主线程 CPU 常驻 93%,疑似 busy loop #2607
hanguopeng
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
【问题现象】
dsh web 启动后,在完全空闲状态(无用户请求、无 agent 运行)下,Node.js 主线程 CPU 持续占用 70% 到 94%,一直不降。服务器共 2 核,等于被占满近 1 个核。
运行一段时间后,服务偶尔会自行退出,被 systemd 的 Restart=always 拉起(反代层出现短暂 502)。
【复现步骤】
【诊断证据】
进程 CPU 采样(空闲,2 秒间隔):
PID 1729465,CPU 一直是 93.8%,内存 14.9%
线程级 top 显示:主线程状态 R(running)占 70% CPU,其余 libuv 线程全部 S(sleeping)
strace 采样 3 秒:只有 36 次系统调用(约 0.1 秒),说明 CPU 耗在纯用户态计算死循环,不是 IO 或 syscall 循环。
【环境信息】
版本:@deepseek-ai/dsh 0.1.0-rc.6
Node.js:v22.23.1
系统:Ubuntu 24.04.4 LTS(内核 6.8.0-124,x86_64)
CPU:2 vCPU,内存 1.9G
启动命令:dsh web --port 3080 --host 127.0.0.1 --trusted-host
【影响】
占满 1 个 vCPU,拖累同服务器其他服务。
周期性自行退出导致反代层短暂 502。
内存稳定(约 300MB),是 CPU 问题而非内存泄漏。
【已做的临时缓解】
systemd 加 CPUQuota=60% 限速,让其余服务不受影响,但底层 busy loop 依然存在。
【期望行为】
空闲的 web 服务 CPU 应接近 0%。
dsh-bug-report.md
All reactions