Unitech / Unitech/pm2

TypeError: One of the pids provided is invalid

Open
#5,496 15 comments 3 reactions 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?

Trying to run a ts script, it doesn't work, but I am sure outside of pm2 works, checking the log the error is:

PM2 | Error caught while calling pidusage
PM2 | TypeError: One of the pids provided is invalid
PM2 | at get (C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\node_modules\pidusage\lib\stats.js:78:23)
PM2 | at pidusage (C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\node_modules\pidusage\index.js:30:5)
PM2 | at Object.getMonitorData (C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\lib\God\ActionMethods.js:60:5)
PM2 | at tasks (C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\lib\Worker.js:150:9)
PM2 | at Domain. (C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\lib\Worker.js:193:7)
PM2 | at Domain.run (node:domain:389:15)
PM2 | at Timeout.wrappedTasks [as _onTimeout] (C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\lib\Worker.js:192:7)
PM2 | at listOnTimeout (node:internal/timers:564:17)
PM2 | at process.processTimers (node:internal/timers:507:7)

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Dec 08 2022 00:19:27 GMT+0100 (Central European Standard Time)
===============================================================================
--- Daemon --------------------------------------------------------------------
pm2d version         : 5.2.2
node version         : 18.12.0
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0                : node
user                 : undefined
uid                  : N/A
gid                  : N/A
uptime               : 21min
===============================================================================
--- CLI -----------------------------------------------------------------------
local pm2            : 5.2.2
node version         : 18.12.0
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\leona\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0                : C:\Program Files\nodejs\node.exe
user                 : dev
===============================================================================
--- System info ---------------------------------------------------------------
arch                 : x64
platform             : win32
type                 : Windows_NT
cpus                 : AMD Ryzen 3 3250U with Radeon Graphics
cpus nb              : 4
freemem              : 816803840
totalmem             : 6390263808
home                 : C:\Users\leona
===============================================================================
--- PM2 list ------------------------------------------------------------------
┌─────┬────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name           │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1   │ trackPrices    │ default     │ 1.0.0   │ fork    │ N/A      │ 6m     │ 0    │ online    │ 0%       │ 0b       │ dev      │ disabled │
│ 0   │ ts-node        │ default     │ N/A     │ fork    │ 0        │ 0      │ 15   │ errored   │ 0%       │ 0b       │ dev      │ enabled  │
└─────┴────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module                       │ version       │ pid      │ status   │ ↺    │ cpu      │ mem      │ user     │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 2  │ date                         │ 2.0.2         │ 19416    │ online   │ 0    │ 0%       │ 0b       │ dev      │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs ---------------------------------------------------------------
C:\Users\leona\.pm2\pm2.log last 20 lines:
PM2        | 2022-12-08T00:15:24: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:15:24: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:15:54: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:15:54: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:16:24: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:16:24: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:16:54: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:16:54: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:17:25: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:17:25: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:17:55: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:17:55: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:18:25: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:18:25: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:18:55: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:18:55: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:19:25: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:19:25: PM2 error: TypeError: One of the pids provided is invalid
PM2        | 2022-12-08T00:19:27: PM2 error: Error caught while calling pidusage
PM2        | 2022-12-08T00:19:27: PM2 error: TypeError: One of the pids provided is invalid

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

Start with lib/God/ActionMethods.js and lib/Worker.js, then trace how process IDs reach pidusage through node_modules/pidusage/lib/stats.js. Reproduce the reported Windows state containing N/A and 0 PIDs and inspect the monitor-data path. Done means monitoring no longer logs this invalid-PID error for exited or errored processes.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.