Pm2: PM2 generates many processes

Created on 1 Aug 2018  路  3Comments  路  Source: Unitech/pm2

I have many processes pm2 with CPU 100% after run pm2 link.

Part from ~/pm2/agent.log:

2018-08-01T06:55:01.868Z interactor:transporter Connection etablished with remote endpoint
-- FATAL EXCEPTION happened --
2018-08-01T06:55:01.869Z
TypeError: Cannot read property 'length' of undefined
    at AxonTransport._emptyQueue (/usr/local/lib/node_modules/pm2/node_modules/@pm2/agent/src/transporters/Transporter.js:59:20)
    at connect (/usr/local/lib/node_modules/pm2/node_modules/@pm2/agent/src/transporters/Transporter.js:120:14)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:3888:9
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:1064:13)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:969:16
    at Socket.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:3885:13)
    at Object.onceWrapper (events.js:273:13)
    at Socket.emit (events.js:187:15)
    at Socket.EventEmitter.emit (domain.js:460:23)
Re-initiating Agent
[PM2 Agent] Using (Public key: xxx) (Private key: xxxx) (Info node: https://root.keymetrics.io)
2018-08-01T06:55:01.873Z interactor:transporter Error with transporter: read ECONNRESET
2018-08-01T06:55:01.883Z interactor:interface Connect transporters with new endpoints
2018-08-01T06:55:01.892Z interactor:transporter Trying to reconnect to remote endpoint
2018-08-01T06:55:01.894Z interactor:interface Received event from axon transporter
[NETWORK] Error : read ECONNRESET
2018-08-01T06:55:01.933Z interactor:transporter Connection etablished with remote endpoint
-- FATAL EXCEPTION happened --
2018-08-01T06:55:01.933Z
TypeError: Cannot read property 'length' of undefined
    at AxonTransport._emptyQueue (/usr/local/lib/node_modules/pm2/node_modules/@pm2/agent/src/transporters/Transporter.js:59:20)
    at connect (/usr/local/lib/node_modules/pm2/node_modules/@pm2/agent/src/transporters/Transporter.js:120:14)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:3888:9
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:1064:13)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:969:16
    at Socket.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:3885:13)
    at Object.onceWrapper (events.js:273:13)
    at Socket.emit (events.js:187:15)
    at Socket.EventEmitter.emit (domain.js:460:23)
Re-initiating Agent
[PM2 Agent] Using (Public key: xxx) (Private key: xxx) (Info node: https://root.keymetrics.io)
2018-08-01T06:55:01.948Z interactor:transporter Trying to reconnect to remote endpoint
2018-08-01T06:55:01.956Z interactor:transporter Trying to reconnect to remote endpoint
[PM2.IO][WARNING] Not managed to connect to PM2 Plus, retrying in background.
Succesfully launched new agent
[PM2.IO][WARNING] Not managed to connect to PM2 Plus, retrying in background.
Succesfully launched new agent
2018-08-01T06:55:02.060Z interactor:transporter Connection etablished with remote endpoint
-- FATAL EXCEPTION happened --
2018-08-01T06:55:02.060Z
TypeError: Cannot read property 'length' of undefined
    at AxonTransport._emptyQueue (/usr/local/lib/node_modules/pm2/node_modules/@pm2/agent/src/transporters/Transporter.js:59:20)
    at connect (/usr/local/lib/node_modules/pm2/node_modules/@pm2/agent/src/transporters/Transporter.js:120:14)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:3888:9
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
    at iteratorCallback (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:1064:13)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:969:16
    at Socket.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:3885:13)
    at Object.onceWrapper (events.js:273:13)
    at Socket.emit (events.js:187:15)
    at Socket.EventEmitter.emit (domain.js:460:23)
Re-initiating Agent
[PM2 Agent] Using (Public key: xxx) (Private key: xxx) (Info node: https://root.keymetrics.io)
2018-08-01T06:55:02.152Z interactor:transporter Internet is reachable again
2018-08-01T06:55:02.222Z interactor:daemon Send to process daemon is started
2018-08-01T06:55:02.225Z interactor:reverse Reverse interactor is listening
2018-08-01T06:55:02.225Z interactor:daemon Interactor daemon started
2018-08-01T06:55:02.232Z interactor:pm2:interface PM2Interface instantiate
2018-08-01T06:55:02.261Z interactor:transporter Internet is reachable again
[PM2 Agent] Launching agent
2018-08-01T06:55:02.608Z interactor:daemon MACHINE_NAME=xxx
2018-08-01T06:55:02.609Z interactor:daemon PUBLIC_KEY=xxx
2018-08-01T06:55:02.609Z interactor:daemon WEBSOCKET_ENABLED=false
2018-08-01T06:55:02.609Z interactor:daemon AXON_ENABLED=true
2018-08-01T06:55:02.609Z interactor:daemon ROOT_URL=https://root.keymetrics.io
2018-08-01T06:55:02.609Z interactor:interface New transporter interface
2018-08-01T06:55:02.609Z interactor:interface Bind [axon] transport to transporter interface
[PM2 Agent] Launching agent
2018-08-01T06:55:02.618Z interactor:daemon MACHINE_NAME=xxx
2018-08-01T06:55:02.619Z interactor:daemon PUBLIC_KEY=xxx
2018-08-01T06:55:02.619Z interactor:daemon WEBSOCKET_ENABLED=false
2018-08-01T06:55:02.619Z interactor:daemon AXON_ENABLED=true
2018-08-01T06:55:02.619Z interactor:daemon ROOT_URL=https://root.keymetrics.io
2018-08-01T06:55:02.619Z interactor:interface New transporter interface
2018-08-01T06:55:02.619Z interactor:interface Bind [axon] transport to transporter interface
2018-08-01T06:55:02.638Z interactor:daemon Launching Interactor RPC server (bind to /Users/alex/.pm2/interactor.sock)
2018-08-01T06:55:02.644Z interactor:daemon Ping root called https://root.keymetrics.io
2018-08-01T06:55:02.647Z interactor:daemon Launching Interactor RPC server (bind to /Users/alex/.pm2/interactor.sock)
2018-08-01T06:55:02.659Z interactor:daemon Ping root called https://root.keymetrics.io
[PM2 Agent] Launching agent
2018-08-01T06:55:03.019Z interactor:daemon MACHINE_NAME=xxx
2018-08-01T06:55:03.019Z interactor:daemon PUBLIC_KEY=xxx
2018-08-01T06:55:03.019Z interactor:daemon WEBSOCKET_ENABLED=false
2018-08-01T06:55:03.019Z interactor:daemon AXON_ENABLED=true
2018-08-01T06:55:03.019Z interactor:daemon ROOT_URL=https://root.keymetrics.io
2018-08-01T06:55:03.020Z interactor:interface New transporter interface
2018-08-01T06:55:03.020Z interactor:interface Bind [axon] transport to transporter interface
2018-08-01T06:55:03.042Z interactor:daemon Launching Interactor RPC server (bind to /Users/alex/.pm2/interactor.sock)
2018-08-01T06:55:03.050Z interactor:daemon Ping root called https://root.keymetrics.io
2018-08-01T06:55:03.166Z interactor:interface Connect transporters with new endpoints
2018-08-01T06:55:05.713Z interactor:interface Connect transporters with new endpoints
2018-08-01T06:55:06.080Z interactor:daemon Got an a error on ping root Error: getaddrinfo ENOTFOUND root.keymetrics.io root.keymetrics.io:443
2018-08-01T06:55:06.081Z interactor:daemon Error while trying to retrieve endpoints : Error: getaddrinfo ENOTFOUND root.keymetrics.io root.keymetrics.io:443
2018-08-01T06:55:06.081Z interactor:daemon Retrying to retrieve endpoints...
2018-08-01T06:55:06.287Z interactor:daemon Ping root called https://root.keymetrics.io

pm2 report:

===============================================================================
--- PM2 REPORT (Wed Aug 01 2018 09:54:53 GMT+0300 (GMT+03:00)) ----------------
===============================================================================
--- Daemon --------------------------------------------------------------------
pm2d version         : 3.0.3
node version         : 10.7.0
node path            : not found
argv                 : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : alex
uid                  : 501
gid                  : 20
uptime               : 1min
===============================================================================
--- CLI -----------------------------------------------------------------------
local pm2            : 3.0.3
node version         : 10.7.0
node path            : not found
argv                 : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : alex
uid                  : 501
gid                  : 20
===============================================================================
--- System info ---------------------------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i7-4558U CPU @ 2.80GHz
cpus nb              : 4
freemem              : 8299335680
totalmem             : 17179869184
home                 : /Users/alex

OS masOs 10.13.6

In progress

Most helpful comment

Fixed & Published, just update:

npm install pm2@latest -g
pm2 update

All 3 comments

Had the exact same issue. Downgrading PM2 to 2.10.4 helped (npm i -g [email protected] && pm2 update).

Fixed & Published, just update:

npm install pm2@latest -g
pm2 update
Was this page helpful?
0 / 5 - 0 ratings

Related issues

getvega picture getvega  路  3Comments

psparago picture psparago  路  3Comments

rajendar38 picture rajendar38  路  3Comments

mario-mui picture mario-mui  路  3Comments

chaos-git picture chaos-git  路  3Comments