connect EAGAIN /home/user/.pm2/rpc.sock
Under high load (lots of apps running, like 250, each eating 50 - 60 MB of memory on a 128 GB Ubuntu 22.04 box, with 128 GB VM), this happens almost daily when issuing pm2 list or any other pm2 command:
connect EAGAIN /home/user/.pm2/rpc.sock
node:events:497
throw er; // Unhandled 'error' event
^
Error: connect EAGAIN /home/user/.pm2/rpc.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)
Emitted 'error' event on ReqSocket instance at:
at Socket.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/sock.js:201:49)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'connect',
address: '/home/user/.pm2/rpc.sock'
}
Node.js v20.17.0
After that the pm2 list "disappears", somehow the processes still run in an unattached "zombie" state and do their thing, but the connection to the pm2 command line app is broken until I issue pm2 update which sometimes re-links them, and sometimes not, so all I can do to get control of my apps again is kill -9 them, kill PM2 God Process (of which there are strangely multiple, is that expected?), kill everything like Kylo Ren. Sometimes rm -rf ~/.pm2 also helps but the zombie processes often are still there and keep resurrecting.
I mean perhaps the system is overwhelmed by launching so many apps, but all exceptions should be caught and handled gracefully, right?
Otherwise great software, I don't know what I'd do without it. That's what makes this so difficult!