Nodejs cluster报错Error [ERR_IPC_CHANNEL_CLOSED]: channel closed

Serepta ·
更新时间:2024-11-10
· 560 次阅读

这个错误是在Master进程向子进程send消息时发现pipe已经关闭了的情况下由Master进程报出来的。

2019-12-16 14:33:02,pid-170096, Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
    at ChildProcess.target.send (internal/child_process.js:578:16)
    at Worker.send (internal/cluster/worker.js:54:28)

经排查这个问题原因是子进程占用内存太多,触发了Linux内核的OOM Killer机制通过SIGKILL信号kill掉了子进程。在Centos 6上查看/var/log/messages可以找到相关日志:

root@prod:/var/log> grep "Kill" messages | grep node
Dec 16 14:33:00 8_17 kernel: Out of memory: Kill process 170341 (node) score 8 or sacrifice child
Dec 16 14:33:00 8_17 kernel: Killed process 170341, UID 0, (node) total-vm:2174692kB, anon-rss:1251432kB, file-rss:8kB
Dec 16 14:35:54 8_17 kernel: Out of memory: Kill process 175318 (node) score 8 or sacrifice child
Dec 16 14:35:54 8_17 kernel: Killed process 175318, UID 0, (node) total-vm:2175532kB, anon-rss:1252000kB, file-rss:40kB
Dec 16 14:42:04 8_17 kernel: Out of memory: Kill process 184236 (node) score 8 or sacrifice child
Dec 16 14:42:04 8_17 kernel: Killed process 184236, UID 0, (node) total-vm:2186980kB, anon-rss:1264544kB, file-rss:172kB
Dec 16 14:42:04 8_17 kernel: Out of memory: Kill process 184240 (node) score 8 or sacrifice child
Dec 16 14:42:04 8_17 kernel: Killed process 184240, UID 0, (node) total-vm:2186980kB, anon-rss:1264544kB, file-rss:172kB
Dec 16 14:42:32 8_17 kernel: Out of memory: Kill process 184250 (node) score 9 or sacrifice child
Dec 16 14:42:32 8_17 kernel: Killed process 184250, UID 0, (node) total-vm:2213728kB, anon-rss:1290780kB, file-rss:208kB
Dec 16 14:43:08 8_17 kernel: Out of memory: Kill process 184629 (node) score 10 or sacrifice child
Dec 16 14:43:08 8_17 kernel: Killed process 184629, UID 0, (node) total-vm:2229684kB, anon-rss:1307020kB, file-rss:664kB
Dec 16 14:43:08 8_17 kernel: Out of memory: Kill process 184277 (node) score 9 or sacrifice child
Dec 16 14:43:08 8_17 kernel: Killed process 184277, UID 0, (node) total-vm:2216760kB, anon-rss:1291796kB, file-rss:616kB

作者:pengpengzhou



cluster ipc error

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章