Monday, 17 April 2017

pm2 on windows keeps restarting

i want to run 8 instances on win10(it works well on linux), and node version is 7.5.0 ,and i run through this command :

pm2 start ecosystem.config.js --en production

ecosystem.config.js:

apps : [

// First application
{
  name      : 'nkc2',
  script    : 'server.js',
  instances: 8,
  exec_mode: 'cluster',
  watch: false,
  cron_restart: '0 0/30 * * * ',
  autorestart: true,
  env: {
    NODE_ENV: 'development'
  },
  env_production : {
    NODE_ENV: 'production'
  }
}
]

it did open 8 instances, but it just keeps restarting ... some instances run with others crash... but remains 8

and my app uses a static port , but i remember that the pm2 is similar to 'cluster' module, and it works fine on linux, i'm really confuse about this... my app crashes sometime for unknown reason, so i have to add a cron job.

here's logs:

2017-04-17 18:55:01: App [nkc2] with id [3] and pid [804], exited with code 
[0] via signal [SIGINT]
PM2        | 2017-04-17 18:55:01: Starting execution sequence in -cluster 
mode- for app name:nkc2 id:3
PM2        | 2017-04-17 18:55:01: App [nkc2] with id [4] and pid [9048], 
exited with code [0] via signal [SIGINT]
PM2        | 2017-04-17 18:55:01: Starting execution sequence in -cluster 
mode- for app name:nkc2 id:4
PM2        | 2017-04-17 18:55:01: App name:nkc2 id:3 online
PM2        | 2017-04-17 18:55:01: App name:nkc2 id:4 online
PM2        | 2017-04-17 18:55:01: App [nkc2] with id [5] and pid [6088], 
exited with code [0] via signal [SIGINT]
PM2        | 2017-04-17 18:55:01: Starting execution sequence in -cluster mode- for app name:nkc2 id:5
PM2        | 2017-04-17 18:55:02: App name:nkc2 id:5 online
PM2        | 2017-04-17 18:55:02: App [nkc2] with id [7] and pid [1408], 
exited with code [0] via signal [SIGINT]
PM2        | 2017-04-17 18:55:02: Starting execution sequence in -cluster 
mode- for app name:nkc2 id:7
PM2        | 2017-04-17 18:55:02: App [nkc2] with id [6] and pid [3980], 
exited with code [0] via signal [SIGINT]
PM2        | 2017-04-17 18:55:02: Starting execution sequence in -cluster mode- for app name:nkc2 id:6
PM2        | 2017-04-17 18:55:02: App name:nkc2 id:6 online
PM2        | 2017-04-17 18:55:02: App name:nkc2 id:7 online
PM2        | 2017-04-17 18:55:03: App [nkc2] with id [1] and pid [5256], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-17 18:55:03: Starting execution sequence in -cluster mode- for app name:nkc2 id:1
PM2        | 2017-04-17 18:55:03: Error: write EMFILE
PM2        |     at exports._errnoException (util.js:1023:11)
PM2        |     at ChildProcess.target._send (internal/child_process.js:667:20)
PM2        |     at ChildProcess.target.send (internal/child_process.js:551:19)
PM2        |     at sendHelper (internal/cluster/utils.js:25:15)
PM2        |     at send (internal/cluster/master.js:343:10)
PM2        |     at handle.add (internal/cluster/master.js:315:5)
PM2        |     at SharedHandle.add (internal/cluster/shared_handle.js:31:3)
PM2        |     at queryServer (internal/cluster/master.js:304:10)
PM2        |     at Worker.onmessage (internal/cluster/master.js:248:5)
PM2        |     at ChildProcess.onInternalMessage 
(internal/cluster/utils.js:42:8)
PM2        | 2017-04-17 18:55:03: 

did anyone deal with this before? give me a hand plz



via user7848170

No comments:

Post a Comment