Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.59k stars 2.62k forks source link

Issue with Args dropping off after a restart #5905

Open adammcclain-pantomath opened 1 month ago

adammcclain-pantomath commented 1 month ago

What's going wrong?

We use PM2 to run a custom CLI application that takes in specific arguments. We're using the ecosystem.config.js file to define our PM2 application and typically our script is the whole command. For example, we might run cli foo -d bar. On some systems, very rarely, we've run into an issue where the args disappear after the system reboots, just running cli. On those systems, we have added the args attribute to the ecosystem.config.js file and moved our arguments there. Everything seems to work fine after that.

I'm wondering if we should move all of our systems to the use the args attribute. Is that the preferred method? Why would it work on some systems but not the other?

How could we reproduce this issue?

I am unsure. We've been running this on RHEL system with Node 18. I can't reproduce it consistently.

Supporting information

# Run the following commands
$ pm2 report

This was run on one of our systems that had the issue, but we subsequently fixed. If we need to break it again, we can try.

--- PM2 report ----------------------------------------------------------------
Date                 : Wed Oct 23 2024 18:13:28 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.4.2
node version         : 18.20.4
node path            : not found
argv                 : /home/pantomath/.nvm/versions/node/v18.20.4/bin/node,/home/pantomath/.nvm/versions/node/v18.20.4/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : pantomath
uid                  : 1001
gid                  : 1001
uptime               : 3min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.4.2
node version         : 18.20.4
node path            : /home/pantomath/.nvm/versions/node/v18.20.4/bin/pm2
argv                 : /home/pantomath/.nvm/versions/node/v18.20.4/bin/node,/home/pantomath/.nvm/versions/node/v18.20.4/bin/pm2,report
argv0                : node
user                 : pantomath
uid                  : 1001
gid                  : 1001
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
cpus nb              : 2
freemem              : 3129499648
totalmem             : 4093984768
home                 : /home/pantomath
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬──────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name         │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼──────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ pantomath    │ default     │ 0.39.7  │ cluster │ 2296     │ 3m     │ 0    │ online    │ 0.1%     │ 113.0mb  │ pan… │ disabled │
└────┴──────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/pantomath/.pm2/pm2.log last 20 lines:
PM2        | 2024-10-23T18:09:14: PM2 log: pid=2261 msg=process killed
PM2        | 2024-10-23T18:09:14: PM2 log: PM2 successfully stopped
PM2        | 2024-10-23T18:10:10: PM2 log: ===============================================================================
PM2        | 2024-10-23T18:10:11: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2024-10-23T18:10:11: PM2 log: Time                 : Wed Oct 23 2024 18:10:11 GMT+0000 (Coordinated Universal Time)
PM2        | 2024-10-23T18:10:11: PM2 log: PM2 version          : 5.4.2
PM2        | 2024-10-23T18:10:11: PM2 log: Node.js version      : 18.20.4
PM2        | 2024-10-23T18:10:11: PM2 log: Current arch         : x64
PM2        | 2024-10-23T18:10:11: PM2 log: PM2 home             : /home/pantomath/.pm2
PM2        | 2024-10-23T18:10:11: PM2 log: PM2 PID file         : /home/pantomath/.pm2/pm2.pid
PM2        | 2024-10-23T18:10:11: PM2 log: RPC socket file      : /home/pantomath/.pm2/rpc.sock
PM2        | 2024-10-23T18:10:11: PM2 log: BUS socket file      : /home/pantomath/.pm2/pub.sock
PM2        | 2024-10-23T18:10:11: PM2 log: Application log path : /home/pantomath/.pm2/logs
PM2        | 2024-10-23T18:10:11: PM2 log: Worker Interval      : 30000
PM2        | 2024-10-23T18:10:11: PM2 log: Process dump file    : /home/pantomath/.pm2/dump.pm2
PM2        | 2024-10-23T18:10:11: PM2 log: Concurrent actions   : 2
PM2        | 2024-10-23T18:10:11: PM2 log: SIGTERM timeout      : 1600
PM2        | 2024-10-23T18:10:11: PM2 log: ===============================================================================
PM2        | 2024-10-23T18:10:11: PM2 log: App [pantomath:0] starting in -cluster mode-
PM2        | 2024-10-23T18:10:11: PM2 log: App [pantomath:0] online