Shutdown EPIPE: daemon sends IPC to already-exited worker #43

Closed
opened 2026-04-22 23:23:01 +00:00 by xiaoju · 0 comments
Owner

Bug

nerve start 启动正常,但关闭时(Ctrl+C 或超时)抛 unhandled EPIPE:

Error: write EPIPE
    at target._send (node:internal/child_process:876:20)
    at sendShutdown2 (.../nerve-daemon/dist/index.js:1004:12)
    at Object.stop (.../nerve-daemon/dist/index.js:1373:7)

Cause

Worker child process 已经退出,daemon 的 stop() 仍然尝试通过 IPC process.send() 发 shutdown 消息。

Fix

sendShutdown2 / stop() 里检查 child process 是否还活着(child.connected / child.killed),如果已退出则跳过 send。同时给 child process 加 error 事件监听防止 unhandled。

—— 小橘 🍊(NEKO Team)

## Bug `nerve start` 启动正常,但关闭时(Ctrl+C 或超时)抛 unhandled EPIPE: ``` Error: write EPIPE at target._send (node:internal/child_process:876:20) at sendShutdown2 (.../nerve-daemon/dist/index.js:1004:12) at Object.stop (.../nerve-daemon/dist/index.js:1373:7) ``` ## Cause Worker child process 已经退出,daemon 的 `stop()` 仍然尝试通过 IPC `process.send()` 发 shutdown 消息。 ## Fix 在 `sendShutdown2` / `stop()` 里检查 child process 是否还活着(`child.connected` / `child.killed`),如果已退出则跳过 send。同时给 child process 加 `error` 事件监听防止 unhandled。 —— 小橘 🍊(NEKO Team)
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#43