@moonquake2004/dsh-doctor 0.4.30 → 0.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dsh-doctor.mjs +26 -1
- package/package.json +1 -1
package/dsh-doctor.mjs
CHANGED
|
@@ -506,7 +506,32 @@ function checkPort3080() {
|
|
|
506
506
|
srv.on('error', finish((e) => {
|
|
507
507
|
if (e.code === 'EADDRINUSE') {
|
|
508
508
|
const info = portOccupierInfo(port);
|
|
509
|
-
|
|
509
|
+
// 端口被占用 **不等于** 服务健康(#6693):一个在 apply() 里抛错的插件会让 cordis 中断装载链、
|
|
510
|
+
// 进程退出、systemd 重启 —— 表现为"端口绑着、systemd active、页面永远打不开"。故这里真发一次 HTTP:
|
|
511
|
+
// 应答 → 正常;无应答 → 如实报"绑着但不服务",这正是崩溃重启循环的样子。
|
|
512
|
+
const httpAlive = (() => {
|
|
513
|
+
for (const bin of ['curl', 'wget']) {
|
|
514
|
+
try {
|
|
515
|
+
const args = bin === 'curl'
|
|
516
|
+
? ['-s', '-o', '/dev/null', '-w', '%{http_code}', '--max-time', '5', `http://127.0.0.1:${port}/`]
|
|
517
|
+
: ['-q', '-O', '-T', '2', `http://127.0.0.1:${port}/`];
|
|
518
|
+
const rr = spawnSync(bin, args, { encoding: 'utf8', timeout: 8000 });
|
|
519
|
+
const code = String(rr.stdout || '').trim();
|
|
520
|
+
if (bin === 'wget') return rr.status === 0;
|
|
521
|
+
return /^\d{3}$/.test(code) && code !== '000';
|
|
522
|
+
} catch { /* 换下一个工具 */ }
|
|
523
|
+
}
|
|
524
|
+
return null; // 无工具可探测 → 不据此下结论
|
|
525
|
+
})();
|
|
526
|
+
if (info && info.dsh && httpAlive === false) {
|
|
527
|
+
report('env', 'E10-port-3080', false,
|
|
528
|
+
`端口 ${port} 被 dsh 进程占用(PID ${info.pid})但 **HTTP 无应答** —— 绑定成功 ≠ 服务健康:`
|
|
529
|
+
+ `这与"插件在 apply() 期间抛错 → 装载链中断 → 进程退出 → systemd 重启"的崩溃重启循环一致(#6693)`,
|
|
530
|
+
`先在会话外跑 npx @moonquake2004/dsh-doctor --boot-check 找失败的 entry;确认后 --quarantine <包名> 让 dsh 先起来`);
|
|
531
|
+
} else if (info && info.dsh) {
|
|
532
|
+
report('env', 'E10-port-3080', true,
|
|
533
|
+
`端口 ${port} 被 dsh web 实例占用(PID ${info.pid})${httpAlive === true ? '且 HTTP 有应答' : ''}——宿主自身或另一实例,正常`, undefined);
|
|
534
|
+
}
|
|
510
535
|
else if (info) report('env', 'E10-port-3080', false, `端口 ${port} 被其他程序占用(PID ${info.pid}: ${info.cmd}),dsh web 启动会 address in use(#1719)`, `关掉占用进程,或让 dsh web 用别的端口`);
|
|
511
536
|
else report('env', 'E10-port-3080', true, `⚠ 端口 ${port} 被占用但无法识别占用者`, undefined);
|
|
512
537
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonquake2004/dsh-doctor",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.31",
|
|
4
4
|
"description": "Offline diagnostic for DeepSeek Harness — 28 built-in + 5 catalog checks across env/profile/session (Layer A checks-as-data), self-update (Layer B), and a semi-automatic LLM observer (Layer C, --observe); Doctor panel in web UI settings.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|