PM2 ignores namespace option when called from a script that is already running through PM2
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?
pm2 ignores namespace option when running pm2 start command from a script that is already running though pm2
this also happens when using ecosystem file with namespace option and also happens when using the pm2 package programatically
this issue was reported and (sopposedly) fixed, but it is still present in version 5.3.0 (latest version in npm at the time I'm writing this)
original isssue: #4778
How could we reproduce this issue?
run pm2 start --namespace n2 script.js from an app that is already running in pm2
Supporting information
PM2 Info
--- PM2 report ----------------------------------------------------------------
Date : Wed Jun 14 2023 21:58:34 GMT-0300 (Argentina Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.3.0
node version : 18.13.0
node path : /home/user/.nvm/versions/node/v18.13.0/bin/pm2
argv : /home/user/.nvm/versions/node/v18.13.0/bin/node,/home/user/.nvm/versions/node/v18.13.0/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : user
uid : 1000
gid : 1000
uptime : 31min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.3.0
node version : 18.13.0
node path : /home/user/.nvm/versions/node/v18.13.0/bin/pm2
argv : /home/user/.nvm/versions/node/v18.13.0/bin/node,/home/user/.nvm/versions/node/v18.13.0/bin/pm2,report
argv0 : node
user : user
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
cpus nb : 4
freemem : 7471771648
totalmem : 16311443456
home : /home/user
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
===============================================================================
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing pm2 start --namespace n2 script.js from an application already running through PM2, then compare the CLI path with the ecosystem-file and programmatic pm2 package paths. Read the handling of namespace options and the behavior described in original issue #4778; done means the started process retains namespace n2 in PM2's process list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100