Unitech / Unitech/pm2

scale works wrong on running applications

Open
#1,332 14 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T: Enhancement T: Feature
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

I have a express application listening on the port 3000 + parseInt(process.env.NODE_APP_INSTANCE || 0)

I can do

pm2 start app.js --name api -i 3

3 instances start to listen on 3000, 3001 and 3002 no problem. I can restart or reload.

if I do

pm2 scale api 4

the four instance start to listen on 3002, ??? if I scale again start to listen on port 3000!

This is my first time using pm2

I have

  • Node 0.12.4
  • NPM 2.11.0
  • PM2 0.12.15

What can I be doing wrong?

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

Reproduce the behavior with app.js using pm2 start app.js --name api -i 3, then scale the api process as described and observe the assigned ports. Trace the scaling and instance-environment handling in PM2; done means the behavior is explained and the instance ports remain correct after repeated scaling, with a regression test or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
cli, devops
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.