[Bug] Desktop (Linux) zcode-host 子进程两次崩溃于 writeHostLog 的 uncaughtException "write EPIPE",崩溃后应用卡死无自愈,须手动重启
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
环境
- 应用:ZCode Desktop 3.9.2-6069(官方 .deb 安装,
/opt/ZCode) - 系统:Linux Mint 22.3 (Zena),内核 6.14.0-37-generic,x64
- 发生时间:2026-08-27 00:44:24 与 01:07:07(CST,UTC+8)
问题概述
zcode-host 工具子进程(node.mojom.NodeService,名称 zcode-host-local-1)当晚以完全相同的未捕获异常崩溃了两次:write EPIPE,抛出位置在 host 自身写日志的路径上(writeHostLog → console.log → Socket._write)。
host 进程死后,Electron 主进程和窗口仍然存活,所以应用不会表现为闪退——而是所有会话失去响应,界面整体卡死(侧栏、任务列表仍可显示,但内核已空)。崩溃后没有任何自动恢复 / 重新拉起 host 的动作,唯一出路是手动重启应用。重启后被中断的会话也无法恢复(zcode-session.readSession FAIL — Session is not active)。
日志证据(两次崩溃)
第一次崩溃 — 00:44:24 CST,crash_id: cc00b650-afd9-4c1a-8aa0-897d2dc2eb53:
[error] [main] [host-log] [zcode-host] uncaughtException origin=uncaughtException:
{"name":"Error","message":"write EPIPE","stack":"Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:159:15)
at writeGeneric (node:internal/stream_base_commons:150:3)
at Socket._writeGeneric (node:net:966:11)
at Socket._write (node:net:978:8)
at writeOrBuffer (node:internal/streams/writable:570:12)
at Writable.write (node:internal/streams/writable:508:10)
at console.value (node:internal/console/constructor:313:16)
at console.log (node:internal/console/constructor:416:26)
at writeHostLog (file:///opt/ZCode/resources/app.asar/out/host/index.js:1582:42225)"}
[warn] [main] [crash-capture] child-process-gone: {"type":"Utility","reason":"abnormal-exit","exitCode":256,"serviceName":"node.mojom.NodeService","name":"zcode-host-local-1"}
[error] [main] [stability] perf_crash reported {"crash_id":"cc00b650-...","crash_cause":"abnormal_exit","exit_code":256,"process_name":"zcode-host-local-1"}
[info] [main] [spawnHostProcess] host process (local-1) exited with code 1
第二次崩溃 — 01:07:07 CST,crash_id: 85420f90-54a9-4cb1-ab1d-259493701c3e:堆栈与退出路径逐字节一致(同为 writeHostLog 帧,exitCode: 256,之后同样没有重新拉起 host)。
第二次崩溃 后界面卡死约 5 分钟,直到我手动重启应用。重启时读到:
[warn] [zcode-host] [rpc:call] zcode-session.readSession FAIL
ZCodeProtocolClientError: Session is not active: sess_037fbad6-db24-4b53-a67b-e7d45df9b9ed
崩溃前的上下文
- 第一次崩溃 发生在一个任务会话运行期间,前约 1.4 秒刚出现
ZCode Protocol session snapshot slow警告。 - 第二次崩溃 发生在打开任务、读取其会话历史快照(
readSession 历史快照读取完成)约 15 秒后,其间有一波约 266 行的日志洪峰。 - 当晚主日志中反复出现
[web-remote-control] dropped buffered outbound payloads警告(约每 1–10 分钟一次)——不确定是否相关。 ~/.zcode/v2/crash/live/下没有生成 minidump(仅以electron_callback方式捕获);CLI 层日志(~/.zcode/cli/log/*.jsonl)为 0 错误——故障完全位于桌面端 host 层。
期望行为
- 写日志失败(日志管道上的 EPIPE)应当被捕获并降级处理,不应作为 uncaughtException 传播并杀死整个 host 进程。
- host 进程意外退出后应自动重新拉起;至少界面应显式报错,而不是无声卡死。
临时解决方法
手动重启应用。任务列表和历史记录本地持久化、重启后完好,但被中断的会话无法续跑。
关联 issue
#374 报告了 host 进程因 V8 堆耗尽崩溃且应用无法自愈——根因不同(OOM vs 本例的日志管道 EPIPE),但后果一致:host 进程死亡后应用无自愈能力,界面无声卡死。"host 崩溃后无法自愈"这已是第二次以不同形式被报告,建议一并考虑加固。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the bundled host entry point at out/host/index.js, especially writeHostLog and the spawnHostProcess exit path. Reproduce or trace the EPIPE and abnormal-exit evidence, then check the crash-capture and stability handling. Done means a failed log pipe no longer kills the host, and an unexpected host exit either recovers automatically or reports a clear error instead of leaving the interface unresponsive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript, node.js
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100