pm2
pm2 copied to clipboard
Monitoring : Cpu usage stuck at 0% even if real cpu usage is at ~30%-40%
What's going wrong?
After updating to last pm2 version command pm2 ls
display cpu at 0% usage but command pm2 monit
display real cpu usage for ~30-40%
I use pm2-metrics which collect the 0% cpu from pm2 ls
apparently.
How could we reproduce this issue?
Good question i dont know, for me it happened after updating pm2 to last version.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Thu Sep 03 2020 15:10:43 GMT+0200 (UTC+02:00)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.4.1
node version : 14.4.0
node path : /home/ouraios/.npm-packages/bin/pm2
argv : /usr/bin/node,/home/ouraios/.npm-packages/lib64/node_modules/pm2/lib/Daemon.js
argv0 : node
user : ouraios
uid : 1001
gid : 100
uptime : 12min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.4.1
node version : 14.4.0
node path : /home/ouraios/.npm-packages/bin/pm2
argv : /usr/bin/node,/home/ouraios/.npm-packages/bin/pm2,report
argv0 : node
user : ouraios
uid : 1001
gid : 100
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz
cpus nb : 8
freemem : 27916460032
totalmem : 42949672960
home : /home/ouraios
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ API_PROD │ default │ 0.0.0 │ cluster │ 19615 │ 59s │ 1 │ online │ 47% │ 287.6mb │ ouraios │ disabled │
│ 4 │ API_PROD │ default │ 0.0.0 │ cluster │ 19650 │ 57s │ 1 │ online │ 59.8% │ 377.3mb │ ouraios │ disabled │
└─────┴────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬───────────────────────────────────────┬────────────────────┬───────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module │ version │ pid │ status │ ↺ │ cpu │ mem │ user │
├────┼───────────────────────────────────────┼────────────────────┼───────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 5 │ pm2-metrics │ 1.0.38 │ 16739 │ online │ 0 │ 0% │ 60.0mb │ ouraios │
└────┴───────────────────────────────────────┴────────────────────┴───────┴──────────┴──────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/ouraios/.pm2/pm2.log last 20 lines:
PM2 | 2020-09-03T14:57:55: PM2 log: App [API_PROD:1] starting in -cluster mode-
PM2 | 2020-09-03T14:57:55: PM2 log: App [API_PROD:1] onlinee-
PM2 | 2020-09-03T14:57:55: PM2 log: App [API_PROD:4] starting in -cluster mode-
PM2 | 2020-09-03T14:57:55: PM2 log: App [API_PROD:4] online
PM2 | 2020-09-03T14:57:55: PM2 log: App [pm2-metrics:5] starting in -fork mode-
PM2 | 2020-09-03T14:57:55: PM2 log: App [pm2-metrics:5] online
PM2 | 2020-09-03T15:09:44: PM2 log: App [API_PROD:1] starting in -cluster mode-
PM2 | 2020-09-03T15:09:44: PM2 log: App [API_PROD:1] online
PM2 | 2020-09-03T15:09:46: PM2 log: -reload- New worker listening
PM2 | 2020-09-03T15:09:46: PM2 log: Stopping app:API_PROD id:_old_1
PM2 | 2020-09-03T15:09:46: PM2 log: App name:API_PROD id:_old_1 disconnected
PM2 | 2020-09-03T15:09:46: PM2 log: App [API_PROD:_old_1] exited with code [0] via signal [SIGINT]
PM2 | 2020-09-03T15:09:46: PM2 log: pid=16610 msg=process killed
PM2 | 2020-09-03T15:09:46: PM2 log: App [API_PROD:4] starting in -cluster mode-
PM2 | 2020-09-03T15:09:46: PM2 log: App [API_PROD:4] online
PM2 | 2020-09-03T15:09:47: PM2 log: -reload- New worker listening
PM2 | 2020-09-03T15:09:47: PM2 log: Stopping app:API_PROD id:_old_4
PM2 | 2020-09-03T15:09:47: PM2 log: App name:API_PROD id:_old_4 disconnected
PM2 | 2020-09-03T15:09:47: PM2 log: App [API_PROD:_old_4] exited with code [0] via signal [SIGINT]
PM2 | 2020-09-03T15:09:48: PM2 log: pid=16643 msg=process killed
Same here. Since the last update, pm2 ls
always shows cpu 0%.
But, if you type pm2 reset 99
, the same table is shown with the correct value. So right now I'm using reset to see cpu usage.
I put "99" because it doesn't exists, so you will see Error: 99 id unkown, but the table will be shown anyway, without resetting anything.
I hope this issue is fixed soon.
Hi, it's still here in version 4.5.6
Any thoughts when it would be fixed?
Hi its still here in pm2 version 5.2.2 ubuntu 22.04 npm 6.14.17 node v14.21.1
Will this be fixed?
But, if you type
pm2 reset 99
, the same table is shown with the correct value. So right now I'm using reset to see cpu usage.
Thanks @JAlbertoGonzalez this helped me
Same here
Bit off topic, sorry in advance:
But even Angular compiler process shows up with a max of 50MB memory usage, and for sure its a lot more. Anyone has the same problem with Mem: XXX usage instead of CPU, showing way to low value and never changing?
But other (NX) apps also never go above 50MB memory usage.. So it seems like PM2 is creating a fork or something, and only reads the parent cpu/memory usage.. Thats the feeling I get with this CPU/MEM issue
Thanks
Same here
same issue here with [email protected]
and [email protected]
Almost 4-year old issue, pm2 reset 999
is the only solution to properly show CPU usage. Wow.