You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

多次执行pm2 update致服务终止、PM2命令触发ERR_SERVER_ALREADY_LISTEN错误及内存耗尽问题求助

多次执行pm2 update致服务终止、PM2命令触发ERR_SERVER_ALREADY_LISTEN错误及内存耗尽问题求助

各位大佬好,我最近碰到一个特别诡异的PM2问题,折腾了好半天没头绪,来这儿求大家帮忙看看!

问题场景

不管我运行任何PM2命令(比如最基础的pm2 list),控制台只会返回守护进程启动成功的提示:

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized

但实际去看PM2的日志,才发现里面藏着严重的错误,而且后台还在不断启动node /usr/local/bin/pm2 update进程,最后直接把服务器内存耗干了。

详细错误日志

PM2日志里的关键内容如下,核心错误是ERR_SERVER_ALREADY_LISTEN:

===============================================================================
2023-11-15T14:06:46: PM2 log: --- New PM2 Daemon started
----------------------------------------------------
2023-11-15T14:06:46: PM2 log: Time                 : Wed Nov 15 2023 14:06:46 GMT+0000 (Coordinated Universal Time)
2023-11-15T14:06:46: PM2 log: PM2 version          : 5.3.0
2023-11-15T14:06:46: PM2 log: Node.js version      : 16.20.2
2023-11-15T14:06:46: PM2 log: Current arch         : x64
2023-11-15T14:06:46: PM2 log: PM2 home             : /root/.pm2
2023-11-15T14:06:46: PM2 log: PM2 PID file         : /root/.pm2/pm2.pid
2023-11-15T14:06:46: PM2 log: RPC socket file      : /root/.pm2/rpc.sock
2023-11-15T14:06:46: PM2 log: BUS socket file      : /root/.pm2/pub.sock
2023-11-15T14:06:46: PM2 log: Application log path : /root/.pm2/logs
2023-11-15T14:06:46: PM2 log: Worker Interval      : 30000
2023-11-15T14:06:46: PM2 log: Process dump file    : /root/.pm2/dump.pm2
2023-11-15T14:06:46: PM2 log: Concurrent actions   : 2
2023-11-15T14:06:46: PM2 log: SIGTERM timeout      : 1600
===============================================================================
[PM2] PM2 Successfully daemonized
2023-11-15T14:06:46: PM2 log:
===============================================================================
2023-11-15T14:06:46: PM2 log: --- PM2 global error caught
---------------------------------------------------
2023-11-15T14:06:46: PM2 log: Time                 : Wed Nov 15 2023 14:06:46 GMT+0000 (Coordinated Universal Time)
2023-11-15T14:06:46: PM2 error: Listen method has been called more than once without closing.
2023-11-15T14:06:46: PM2 error: Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called more than once without closing.
    at new NodeError (node:internal/errors:387:5)
    at Server.listen (node:net:1550:11)
    at Server.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/sock.js:408:21)
    at Server.emit (node:events:513:28)
    at Server.emit (node:domain:489:12)
    at Pipe.onconnection (node:net:1696:10)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17)
2023-11-15T14:06:46: PM2 log:
===============================================================================
2023-11-15T14:06:46: PM2 error: [PM2] Resurrecting PM2
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
node:net:1550
    throw new ERR_SERVER_ALREADY_LISTEN();
    ^

Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called more than once without closing.
    at new NodeError (node:internal/errors:387:5)
    at Server.listen (node:net:1550:11)
    at Server.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/sock.js:408:21)
    at Server.emit (node:events:513:28)
    at Server.emit (node:domain:489:12)
    at Pipe.onconnection (node:net:1696:10)
    at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'ERR_SERVER_ALREADY_LISTEN'
}

而且后台会不断生成大量node /usr/local/bin/pm2 update进程,直接把服务器内存吃满了。

我尝试过的操作

目前我只试过重启服务器,但重启后问题依然存在,只要一执行PM2命令就会重复触发这个错误。

有没有大佬遇到过类似的问题?求给个可行的解决思路或者步骤,万分感谢!

备注:内容来源于stack exchange,提问作者Milos

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 08:38:07