Unitech / Unitech/pm2

PM2 ignores namespace option when called from a script that is already running through PM2

Open
#5,622 3 comments 2 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?

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.