PM2 won't start after update
What's going wrong?
Hangs on start. Reinstalling does not fix the problem.
[PM2] Spawning PM2 daemon with pm2_home=/home/dreaddy/.pm2 [PM2] PM2 Successfully daemonized [PM2] Starting /home/dreaddy/Projects/socache-server/index.js in fork_mode (1 instance) [PM2] Done.
then hangs........
How could we reproduce this issue?
Do the recommended update .
Supporting information
$ pm2 report
[PM2] Spawning PM2 daemon with pm2_home=/home/dreaddy/.pm2
[PM2] PM2 Successfully daemonized
===============================================================================
--- PM2 REPORT (Tue Jul 24 2018 13:21:34 GMT-0500 (Eastern Standard Time)) ----
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 3.0.1
node version : 10.7.0
node path : /home/dreaddy/.nvm/versions/node/v10.7.0/bin/pm2
argv : /home/dreaddy/.nvm/versions/node/v10.7.0/bin/node,/home/dreaddy/.nvm/versions/node/v10.7.0/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : dreaddy
uid : 1000
gid : 1000
uptime : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 3.0.1
node version : 10.7.0
node path : /home/dreaddy/.nvm/versions/node/v10.7.0/bin/pm2
argv : /home/dreaddy/.nvm/versions/node/v10.7.0/bin/node,/home/dreaddy/.nvm/versions/node/v10.7.0/bin/pm2,report
argv0 : node
user : dreaddy
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
cpus nb : 4
freemem : 2191532032
totalmem : 8245415936
home : /home/dreaddy
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
I'm having this exact same issue since updating to 3.0.1
Same thing here, both 3.0.0 and 3.0.1 – had to downgrade to 2.10.4
Downgrading to 2.10.4 got it working again. 3.0.0 had the same issues as 3.0.1
Same issue here, and switching to 3.0.0 didn't work. Shall try downgrading to 2.10.4
Hi @all
I made some test on my personal computer. It's working as expected on 3.x
Could you share you pm2 report ?
What you can try is to kill pm2 daemon.
I tried pretty much everything: reboot, uninstall, reboot again, killall, install 3.0.0, install 3.0.1, removed /root/.pm2, ... nothing helps.. Actually on two servers – same deal.
I'm running node 8.11.3.
I tried many, many things as well. Uninstall, reinstall 3.0.0. Uninstall, reboot, reinstall 3.0.0. I even nuked the .pm2 folder and killed all runnings pm2 deamon and it just wouldn't work. I experienced the issue on both node 6.14.3 and 8.11.3 running on CentOS 7.5.1804. PM2 reports to follow
Downgrading to 2.10.4 worked.
Note: I also had to remove node_modules, package-lock.json and rebuild the projects.
After I got it all working. I tried updating PM2 once again to the latest. Same problem.
Any solutions?
pm2 update
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
In-memory PM2 is out-of-date, do: $ pm2 update In memory PM2 version: 2.10.4 Local PM2 version: 3.0.1
-------------
██████╗ ███╗ ███╗██████╗ ██╗ ██╗ ██████╗ ██╔══██╗████╗ ████║╚════██╗ ██║ ██╔╝██╔═══██╗ ██████╔╝██╔████╔██║ █████╔╝ ██║ ██╔╝ ██║ ██║ ██╔═══╝ ██║╚██╔╝██║██╔═══╝ ██║ ██╔╝ ██║ ██║ ██║ ██║ ╚═╝ ██║███████╗ ██║██╔╝ ╚██████╔╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝╚═╝ ╚═════╝
https://pm2.io/
Harden your Node.js Production Environment
- Real-time Monitoring Web Interface
- Pro Active Alerting System
- Production Profiling for Memory and CPU
- PM2 Runtime High Availability Fallback
Start using it by typing:
$ pm2 plus
-------------
[PM2] Saving current process list... [PM2] [-] Stopping Modules [PM2] [v] Modules Stopped [PM2] [-] Stopping all Applications [PM2] Applying action deleteProcessId on app [all](ids: 0,1,2) [PM2] socache.dev ✓ [PM2] maildev ✓ [PM2] socache.prod ✓ [PM2] [v] All Applications Stopped [PM2] [-] Stopping Agent [PM2] [v] Agent Stopped [PM2] [-] Stopping PM2 Daemon [PM2] [-] PM2 Daemon Stopped [PM2] Spawning PM2 daemon with pm2_home=/home/dreaddy/.pm2 [PM2] Restoring processes located in /home/dreaddy/.pm2/dump.pm2 [PM2] Process /home/dreaddy/.nvm/versions/node/v10.7.0/bin/maildev restored [PM2] Process /home/dreaddy/Projects/socache-server/index.js restored [PM2] Process /home/dreaddy/Production/socache-server/index.js restored
PM2 updated events.js:167 throw er; // Unhandled 'error' event ^
Error: connect EAGAIN /home/dreaddy/.pm2/rpc.sock
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1163:14)
Emitted 'error' event at:
at Socket.
/usr/src/app # pm2 report
-------------
__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
_\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
_\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
_\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
_\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
_\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
_\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
_\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
_\///______________\///______________\///__\///////////////__
Runtime Edition
PM2 is a Production Process Manager for Node.js applications
with a built-in Load Balancer.
Start and Daemonize any application:
$ pm2 start app.js
Load Balance 4 instances of api.js:
$ pm2 start api.js -i 4
Monitor in production:
$ pm2 monitor
Make pm2 auto-boot at server restart:
$ pm2 startup
To go further checkout:
http://pm2.io/
-------------
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
===============================================================================
--- PM2 REPORT (Tue Jul 24 2018 19:07:46 GMT+0000 (UTC)) ----------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 3.0.1
node version : 8.11.3
node path : not found
argv : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : undefined
uid : 0
gid : 0
uptime : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 3.0.1
node version : 8.11.3
node path : not found
argv : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : undefined
uid : 0
gid : 0
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Core(TM) i7-7Y75 CPU @ 1.30GHz
cpus nb : 2
freemem : 337653760
totalmem : 2096066560
home : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
/usr/src/app # pm2-docker process.yml
[2018-07-24T19:09:24.613Z] PM2 log: Launching in no daemon mode
[2018-07-24T19:09:24.704Z] PM2 log: Starting execution sequence in -cluster mode- for app name:MyAppName id:0
[2018-07-24T19:09:24.792Z] PM2 log: App name:MyAppName id:0 online
[2018-07-24T19:09:24.794Z] PM2 log: Starting execution sequence in -cluster mode- for app name:MyAppName id:1
[2018-07-24T19:09:24.799Z] PM2 error: (node:147) [DEP0007] DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
[2018-07-24T19:09:24.880Z] PM2 log: App name:MyAppName id:1 online
[2018-07-24T19:09:24.882Z] PM2 error: (node:147) [DEP0007] DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
ReferenceError: window is not defined
at Object.module.exports.Object.assign.i (/usr/src/app/webpack:/src/config.js:22:31)
at __webpack_require__ (/usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:19:1)
at Object.<anonymous> (/usr/src/app/webpack:/src/data/sources/ddb/setupDynamoose.js:2:1)
at __webpack_require__ (/usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:19:1)
at Object.<anonymous> (/usr/src/app/webpack:/src/server.js:7:1)
at __webpack_require__ (/usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:19:1)
at /usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:62:1
at Object.<anonymous> (/usr/src/app/server.js:68:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
[2018-07-24T19:09:25.274Z] PM2 log: App name:MyAppName id:0 disconnected
[2018-07-24T19:09:25.276Z] PM2 log: App [MyAppName] with id [0] and pid [157], exited with code [0] via signal [SIGINT]
[2018-07-24T19:09:25.279Z] PM2 log: Starting execution sequence in -cluster mode- for app name:MyAppName id:0
ReferenceError: window is not defined
at Object.module.exports.Object.assign.i (/usr/src/app/webpack:/src/config.js:22:31)
at __webpack_require__ (/usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:19:1)
at Object.<anonymous> (/usr/src/app/webpack:/src/data/sources/ddb/setupDynamoose.js:2:1)
at __webpack_require__ (/usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:19:1)
at Object.<anonymous> (/usr/src/app/webpack:/src/server.js:7:1)
at __webpack_require__ (/usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:19:1)
at /usr/src/app/webpack:/webpack/bootstrap 85ce6d8f625c06cae405:62:1
at Object.<anonymous> (/usr/src/app/server.js:68:10)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
https://pastebin.com/KtRHMiDM https://pastebin.com/cfJd6saQ
[2018-07-24T21:25:42.688Z] PM2 log: ===============================================================================
[2018-07-24T21:25:42.690Z] PM2 log: --- New PM2 Daemon started ----------------------------------------------------
[2018-07-24T21:25:42.691Z] PM2 log: Time : Tue Jul 24 2018 21:25:42 GMT+0200 (CEST)
[2018-07-24T21:25:42.691Z] PM2 log: PM2 version : 3.0.1
[2018-07-24T21:25:42.691Z] PM2 log: Node.js version : 8.11.3
[2018-07-24T21:25:42.691Z] PM2 log: Current arch : x64
[2018-07-24T21:25:42.691Z] PM2 log: PM2 home : /home/maciej/.pm2
[2018-07-24T21:25:42.691Z] PM2 log: PM2 PID file : /home/maciej/.pm2/pm2.pid
[2018-07-24T21:25:42.691Z] PM2 log: RPC socket file : /home/maciej/.pm2/rpc.sock
[2018-07-24T21:25:42.691Z] PM2 log: BUS socket file : /home/maciej/.pm2/pub.sock
[2018-07-24T21:25:42.691Z] PM2 log: Application log path : /home/maciej/.pm2/logs
[2018-07-24T21:25:42.691Z] PM2 log: Process dump file : /home/maciej/.pm2/dump.pm2
[2018-07-24T21:25:42.691Z] PM2 log: Concurrent actions : 2
[2018-07-24T21:25:42.692Z] PM2 log: SIGTERM timeout : 1600
[2018-07-24T21:25:42.692Z] PM2 log: ===============================================================================
[2018-07-24T21:25:47.965Z] PM2 log: Starting execution sequence in -fork mode- for app name:bin id:0
[2018-07-24T21:25:47.970Z] PM2 log: App name:bin id:0 online
[2018-07-24T21:25:47.983Z] PM2 log: ===============================================================================
[2018-07-24T21:25:47.983Z] PM2 log: --- PM2 global error caught ---------------------------------------------------
[2018-07-24T21:25:47.984Z] PM2 log: Time : Tue Jul 24 2018 21:25:47 GMT+0200 (CEST)
[2018-07-24T21:25:47.984Z] PM2 error: Buffer.alloc is not a function
[2018-07-24T21:25:47.984Z] PM2 error: TypeError: Buffer.alloc is not a function
at readUntilEnd (/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27:18)
at /usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:68:5
at FSReqWrap.oncomplete (fs.js:135:15)
[2018-07-24T21:25:47.984Z] PM2 log: ===============================================================================
[2018-07-24T21:25:47.984Z] PM2 error: [PM2] Resurrecting PM2
Be sure to have the latest version by doing `npm install pm2@latest -g` before doing this procedure.
[PM2] Saving current process list...
/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27
buf = Buffer.alloc(SIZE)
^
TypeError: Buffer.alloc is not a function
at readUntilEnd (/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27:18)
at /usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:68:5
at FSReqWrap.oncomplete (fs.js:135:15)
This seems to fix it:
/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js
1 var fs = require('fs')
2 var path = require('path')
3 var updateCpu = require('./helpers/cpu')
4 var parallel = require('./helpers/parallel')
5 var history = require('./history')
6 var cpuInfo = null
7 // var Buffer = require('safe-buffer')
COMMENT OUT THE ABOVE LINE ^^
8 var SIZE = 1024 // if the stat file is bigger then this I'll buy you a drink
9
10 function noop () {}
Yeah, we just ran into the same issue. The pidusage dependency is the culprit.
Unfortunately their GitHub repo messed up and doesn't contain all the correct commits?!?! So the code you get when you npm install isn't the same as in the repo. Seems like some of the releases on npm are messed up as well: https://github.com/soyuka/pidusage/issues/72
The line was supposed to be var Buffer = require('safe-buffer').Buffer - I think that would fix it as well
This is good news. Thanks for the response.
Will they roll out a new version or will this be a install trial and error thing for @3.0.1?
I think pinning pidusage to v2.0.13 for the time being will fix it as well
Thank you. I Have not pinned the pidusage to confirm as of this moment. Will wait for an update. Closing issue.
@dreaddymck I think the issue is still relevant for others who have the same issue, so I vote for keeping it open until either a new version of pm2 is released that pins pidusage, or pidusage release a fix - whichever comes first
You should leave this issue open until it is resolved one of two ways
Sorry about that. Got lost in debugs.