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

--instances=-1 stop working #2953

Closed
maksimlikharev opened this issue Jun 19, 2017 · 3 comments
Closed

--instances=-1 stop working #2953

maksimlikharev opened this issue Jun 19, 2017 · 3 comments

Comments

@maksimlikharev
Copy link

What's going wrong?
according to docs -1 to spread the app across all CPUs - 1, so previously if # of CPU 1 it will use 1,
in 2.5.0 pm2 stop starting the service.

How could we reproduce this issue?
pm2 --instances=-1 your-script-runner.js

make sure you have 1 CPU instance

Supporting information

PM2 version: 2.5.0
Node version: v6.9.1
EC2 Amazon Linux t2.small
@maksimlikharev
Copy link
Author

if i'm looking at the correct version of the code, it used to be smarter than that:

env.instances = parseInt(env.instances);
  if (env.instances === 0) {
    env.instances = numCPUs;
  } else if (env.instances < 0) {
    env.instances += numCPUs;
  } else if (env.instances <= 0) {
    env.instances = 1;
  }

should it be ?

env.instances = parseInt(env.instances);
  if (env.instances === 0) {
    env.instances = numCPUs;
  } else if (env.instances < 0) {
    env.instances += numCPUs;
  } 

if (env.instances <= 0) {
    env.instances = 1;
  }

@vmarchaud
Copy link
Contributor

Indeed its my bad i introduced this bug via 35945e8, i'll make a patch quickly, thanks for the report.

@Unitech
Copy link
Owner

Unitech commented Jul 20, 2017

Published on PM2 2.6.0:

$ npm install pm2@latest -g
$ pm2 update

@Unitech Unitech closed this as completed Jul 20, 2017
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants