Unitech / Unitech/pm2

cpu usage always 0% in "pm2 status"

Open
#5,182 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

If I try to see CPU usage using "pm2 status" command, all processes always marked as 0% CPU usage.
I can see the correct CPU usage using "pm2 monit" or even "pm2 report"

How could we reproduce this issue?

Everything was working on my old server, with the same hardware, distro (Ubuntu 18), scripts and commands.
The only difference in this new server is that I used a different image to install the system (New server provider), and also using old versions for pm2, node, npm:

OldServer (pm2 status working):
root@old:~# pm2 --version
5.1.0
root@old:~# node --version
v12.22.5
root@old:~# npm --version
6.14.14

NewServer (pm2 status not working):
root@new:~# pm2 --version
5.1.1
root@new:~# node --version
v12.22.6
root@new:~# npm --version
6.14.15

I tried to downgrade pm2 to 5.1.0 on the new server but the issue persisted.

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Sep 23 2021 10:54:44 GMT-0300 (Brasilia Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.1.1
node version         : 12.22.6
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 5min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.1.1
node version         : 12.22.6
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : AMD Ryzen 7 3700X 8-Core Processor
cpus nb              : 16
freemem              : 20384501760
totalmem             : 67472343040
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name          │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼───────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ PytParser1    │ default     │ N/A     │ fork    │ 11364    │ 5m     │ 0    │ online    │ 0%       │ 319.9mb  │ root     │ disabled │
│ 1   │ PytParser2    │ default     │ N/A     │ fork    │ 11365    │ 5m     │ 0    │ online    │ 0%       │ 311.9mb  │ root     │ disabled │
│ 2   │ PytParser3    │ default     │ N/A     │ fork    │ 11366    │ 5m     │ 0    │ online    │ 18.6%    │ 313.4mb  │ root     │ disabled │
│ 3   │ PytParser4    │ default     │ N/A     │ fork    │ 11369    │ 5m     │ 0    │ online    │ 2.6%     │ 319.0mb  │ root     │ disabled │
│ 4   │ PytParser5    │ default     │ N/A     │ fork    │ 11370    │ 5m     │ 0    │ online    │ 0.1%     │ 314.5mb  │ root     │ disabled │
│ 5   │ PytParser6    │ default     │ N/A     │ fork    │ 11371    │ 5m     │ 0    │ online    │ 15.4%    │ 318.0mb  │ root     │ disabled │
└─────┴───────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2        | 2021-09-23T10:49:03: PM2 log: RPC socket file      : /root/.pm2/rpc.sock
PM2        | 2021-09-23T10:49:03: PM2 log: BUS socket file      : /root/.pm2/pub.sock
PM2        | 2021-09-23T10:49:03: PM2 log: Application log path : /root/.pm2/logs
PM2        | 2021-09-23T10:49:03: PM2 log: Worker Interval      : 30000
PM2        | 2021-09-23T10:49:03: PM2 log: Process dump file    : /root/.pm2/dump.pm2
PM2        | 2021-09-23T10:49:03: PM2 log: Concurrent actions   : 2
PM2        | 2021-09-23T10:49:03: PM2 log: SIGTERM timeout      : 1600
PM2        | 2021-09-23T10:49:03: PM2 log: ===============================================================================
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser1:0] starting in -fork mode-
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser1:0] online
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser2:1] starting in -fork mode-
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser2:1] online
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser3:2] starting in -fork mode-
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser3:2] online
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser4:3] starting in -fork mode-
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser4:3] online
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser5:4] starting in -fork mode-
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser5:4] online
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser6:5] starting in -fork mode-
PM2        | 2021-09-23T10:49:03: PM2 log: App [PytParser6:5] online

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with pm2 status using the reported PM2 5.1.1 and Node 12.22.6 setup, then compare its CPU values with pm2 monit and pm2 report. Trace the pm2 status CPU display path and verify that processes with nonzero usage are shown correctly without regressing the other reports.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, ubuntu
Domain
cli, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.