pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

can't start pm2 using ecosystem.config.js in cluster mode on windows

Open lzszone opened this issue 9 years ago • 2 comments

can't start pm2 using ecosystem.config.js in cluster mode on windows

Supporting information

i run as follow through cmd.exe&git_bash

pm2 start ecosystem.config.js --env production

then it creates several terminal window and closes quickly, repeat this cycle until it exit automatically. and the logs like below

Starting execution sequence in -cluster mode- for app name:nkc2 id:0
PM2        | 2017-04-10 06:21:34: App name:nkc2 id:0 online
PM2        | 2017-04-10 06:21:34: Starting execution sequence in -cluster mode- for app name:nkc2 id:1
PM2        | 2017-04-10 06:21:34: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:34: App name:nkc2 id:1 online
PM2        | 2017-04-10 06:21:34: Starting execution sequence in -cluster mode- for app name:nkc2 id:2
PM2        | 2017-04-10 06:21:34: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:35: App name:nkc2 id:2 online
PM2        | 2017-04-10 06:21:35: Starting execution sequence in -cluster mode- for app name:nkc2 id:3
PM2        | 2017-04-10 06:21:35: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:35: App name:nkc2 id:3 online
PM2        | 2017-04-10 06:21:35: Starting execution sequence in -cluster mode- for app name:nkc2 id:4
PM2        | 2017-04-10 06:21:35: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:35: App name:nkc2 id:4 online
PM2        | 2017-04-10 06:21:35: Starting execution sequence in -cluster mode- for app name:nkc2 id:5
PM2        | 2017-04-10 06:21:35: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:35: App name:nkc2 id:5 online
PM2        | 2017-04-10 06:21:35: Starting execution sequence in -cluster mode- for app name:nkc2 id:6
PM2        | 2017-04-10 06:21:35: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:35: App name:nkc2 id:6 online
PM2        | 2017-04-10 06:21:35: Starting execution sequence in -cluster mode- for app name:nkc2 id:7
PM2        | 2017-04-10 06:21:36: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:36: App name:nkc2 id:7 online
PM2        | 2017-04-10 06:21:36: (node:9316) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2        | 2017-04-10 06:21:37: App [nkc2] with id [0] and pid [14252], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:37: Starting execution sequence in -cluster mode- for app name:nkc2 id:0
PM2        | 2017-04-10 06:21:37: App [nkc2] with id [1] and pid [3224], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:37: Starting execution sequence in -cluster mode- for app name:nkc2 id:1
PM2        | 2017-04-10 06:21:37: App name:nkc2 id:0 online
PM2        | 2017-04-10 06:21:37: App [nkc2] with id [2] and pid [11920], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:37: Starting execution sequence in -cluster mode- for app name:nkc2 id:2
PM2        | 2017-04-10 06:21:37: App name:nkc2 id:1 online
PM2        | 2017-04-10 06:21:37: App [nkc2] with id [3] and pid [13552], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:37: Starting execution sequence in -cluster mode- for app name:nkc2 id:3
PM2        | 2017-04-10 06:21:38: App [nkc2] with id [4] and pid [13696], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:38: Starting execution sequence in -cluster mode- for app name:nkc2 id:4
PM2        | 2017-04-10 06:21:38: App name:nkc2 id:2 online
PM2        | 2017-04-10 06:21:38: App name:nkc2 id:3 online
PM2        | 2017-04-10 06:21:38: App [nkc2] with id [5] and pid [11136], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:38: Starting execution sequence in -cluster mode- for app name:nkc2 id:5
PM2        | 2017-04-10 06:21:38: App name:nkc2 id:4 online
PM2        | 2017-04-10 06:21:38: App [nkc2] with id [6] and pid [12120], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:38: Starting execution sequence in -cluster mode- for app name:nkc2 id:6
PM2        | 2017-04-10 06:21:38: App [nkc2] with id [7] and pid [236], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 06:21:38: Starting execution sequence in -cluster mode- for app name:nkc2 id:7

here is config file

//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'
      }
    }
  ]
PM2 version: `2.4.3`
Node version: `7.8.0`
Windows10

lzszone avatar Apr 09 '17 23:04 lzszone

Your application exit by itself : exited with code [0] Check the logs they are stored inside ~/.pm2/logs/

vmarchaud avatar Apr 09 '17 23:04 vmarchaud

@vmarchaud thank u, there are errors in the logs, i was really confuse about these....

 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-10 12:00:26: ===============================================================================
PM2        | 2017-04-10 12:00:26: --- PM2 global error caught ---------------------------------------------------
PM2        | 2017-04-10 12:00:26: Time                 : Mon Apr 10 2017 12:00:26 GMT+0800 (中国标准时间)
PM2        | 2017-04-10 12:00:26: write EPIPE
PM2        | 2017-04-10 12:00:26: Error: write EPIPE
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 Worker.disconnect (internal/cluster/master.js:349:3)
PM2        |     at Worker.destroy (internal/cluster/master.js:362:10)
PM2        |     at Worker.<anonymous> (C:\Users\lzszo\AppData\Roaming\npm\node_modules\pm2\lib\God.js:178:30)
PM2        |     at Object.onceWrapper (events.js:291:19)
PM2        |     at emitTwo (events.js:106:13)
PM2        | 2017-04-10 12:00:26: ===============================================================================
PM2        | 2017-04-10 12:00:26: [PM2] Resurrecting PM2
PM2        | 2017-04-10 12:00:26: App name:nkc2 id:7 disconnected
PM2        | 2017-04-10 12:00:26: App [nkc2] with id [7] and pid [5592], exited with code [0] via signal [SIGINT]
PM2        | 2017-04-10 12:00:26: App name:nkc2 id:5 online
PM2        | module.js:472
PM2        |     throw err;
PM2        |     ^
PM2        |
PM2        | Error: Cannot find module 'D:\projects\nkc2\bin\pm2'
PM2        |     at Function.Module._resolveFilename (module.js:470:15)
PM2        |     at Function.Module._load (module.js:418:25)
PM2        |     at Module.runMain (module.js:605:10)
PM2        |     at run (bootstrap_node.js:418:7)
PM2        |     at startup (bootstrap_node.js:139:9)
PM2        |     at bootstrap_node.js:533:3
PM2        | 2017-04-10 12:00:27: PM2 successfully forked
PM2        | 2017-04-10 12:01:57: ===============================================================================
PM2        | 2017-04-10 12:01:57: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2017-04-10 12:01:57: Time                 : Mon Apr 10 2017 12:01:57 GMT+0800 (中国标准时间)
PM2        | 2017-04-10 12:01:57: PM2 version          : 2.4.4
PM2        | 2017-04-10 12:01:57: Node.js version      : 7.5.0
PM2        | 2017-04-10 12:01:57: Current arch         : x64
PM2        | 2017-04-10 12:01:57: PM2 home             : C:\Users\lzszo\.pm2
PM2        | 2017-04-10 12:01:57: PM2 PID file         : C:\Users\lzszo\.pm2\pm2.pid
PM2        | 2017-04-10 12:01:57: RPC socket file      : \\.\pipe\rpc.sock
PM2        | 2017-04-10 12:01:57: BUS socket file      : \\.\pipe\pub.sock
PM2        | 2017-04-10 12:01:57: Application log path : C:\Users\lzszo\.pm2\logs
PM2        | 2017-04-10 12:01:57: Process dump file    : C:\Users\lzszo\.pm2\dump.pm2
PM2        | 2017-04-10 12:01:57: Concurrent actions   : 2
PM2        | 2017-04-10 12:01:57: SIGTERM timeout      : 1600
PM2        | 2017-04-10 12:01:57: ===============================================================================

i specified a static port in the app, does this matters? the hole app just work good on linux x_x

lzszone avatar Apr 10 '17 04:04 lzszone