Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error caught while calling pidusage | TypeError: One of the pids provided is invalid #76

Open
Drift91 opened this issue Feb 13, 2023 · 5 comments

Comments

@Drift91
Copy link

Drift91 commented Feb 13, 2023

Description

I seem to be unable to use this daemon. When I try to run my Node app with it, it never runs and pm2 logs gives the following

PM2      | Error caught while calling pidusage
PM2      | TypeError: One of the pids provided is invalid
PM2      |     at get (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\lib\stats.js:78:23)
PM2      |     at pidusage (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\index.js:30:5)
PM2      |     at Object.getMonitorData (C:\ProgramData\npm\npm\node_modules\pm2\lib\God\ActionMethods.js:60:5)
PM2      |     at tasks (C:\ProgramData\npm\npm\node_modules\pm2\lib\Worker.js:150:9)
PM2      |     at Domain.<anonymous> (C:\ProgramData\npm\npm\node_modules\pm2\lib\Worker.js:193:7)
PM2      |     at Domain.run (node:domain:389:15)
PM2      |     at Timeout.wrappedTasks [as _onTimeout] (C:\ProgramData\npm\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)
PM2      | Error caught while calling pidusage
PM2      | TypeError: One of the pids provided is invalid
PM2      |     at get (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\lib\stats.js:78:23)
PM2      |     at pidusage (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\index.js:30:5)
PM2      |     at getMonitorData (C:\ProgramData\npm\npm\node_modules\pm2\lib\God\ActionMethods.js:60:5)
PM2      |     at Server.onmessage (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pm2-axon-rpc\lib\server.js:104:6)
PM2      |     at RepSocket.emit (node:events:513:28)
PM2      |     at RepSocket.emit (node:domain:489:12)
PM2      |     at Parser.<anonymous> (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\rep.js:51:15)
PM2      |     at Parser.emit (node:events:513:28)
PM2      |     at Parser.emit (node:domain:489:12)
PM2      |     at Parser._write (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\amp\lib\stream.js:91:16)

Steps to Reproduce

  1. Fresh install of pm2-installer
  2. Navigate to apps folder
  3. Execute the following: pm2 start npm --name SnailyCADv4 -- run start

Environment

npm run info for some reason throws the error, Missing script: "info"
Didn't realize it had to be run in the repo folder. Output:

> [email protected] info
> node ./src/bundle-info/current.js

Running on: 2/13/2023, pm2-installer 3.4.3 with node v18.13.0 and npm 9.4.2 on win32-10.0.20348.
@sheldonpang
Copy link

Having same issue

Running on: 2/20/2023, pm2-installer 3.4.3 with node v18.14.1 and npm 9.3.1 on win32-10.0.22621.

@Choppel
Copy link

Choppel commented Mar 9, 2023

Hello,
I had the same issue a couple of minutes ago. For me the problem was an error with the cwd parameter in the ecosystem.config.js file of a program that I wanted pm2 to start. The directory simply did not exist. Because of the error pm2 did not actually start my program. With version 3.4.2 of pm2-installer the output of "pm2 status" for my program was "online" although it was not really started. With version 3.4.0 of pm2-installer it actually showed "errored" when calling "pm2 status". So the message "One of the pids provided is invalid" is somewhat correct because there is no pid that could be used. But this seems more like an issue with pm2.
I found out about the error only by opening C:\ProgramData\pm2\service\service.log. There it showed some ENOENT messages for my program.

@Drift91 I don't know what the problem with your example could be, but maybe looking at the log file mentioned above might help.

Hope this helps.

@Choppel
Copy link

Choppel commented Apr 26, 2023

@sheldonpang @Drift91 Did my comment help you?

@dlscott12
Copy link

@Drift91 @Choppel @sheldonpang I had the same issue with "Error caught while calling pidusage" and "TypeError: One of the pids provided is invalid" during reboot. I ended up changing the "Log on as" user for the PM2 Service to a valid user (administrator) and now my PM2 apps all restart during reboot. YEAH ;-)

Hope this helps.

Spent hours tweeking with no luck, but had this nagging suspicion that it was security/permission related.

image

@Ildarik
Copy link

Ildarik commented Jul 12, 2023

I had same issue and fixed it by changing Log on as: "Local System account"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants