-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Cluster mode suddenly start giving EADDRINUSE #3336
Comments
Your application is already started in fork, you need to delete it and then start it in cluster. |
Actually that report was incorrect since I tested with fork and cluster by deleting current started application. I was able to run it only by command line. Init json/yml file was unable to run. |
Figured out: If someone comes accross be aware of commands you pass on your script. thanks |
Same problem here. I use ┌────────────────┬────┬─────────┬─────────┬───────┬────────┬─────────┬────────┬──────┬───────────┬────────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├────────────────┼────┼─────────┼─────────┼───────┼────────┼─────────┼────────┼──────┼───────────┼────────┼──────────┤
│ NODE-RRD-PC-v1 │ 25 │ 1.0.0 │ cluster │ 21695 │ online │ 0 │ 22s │ 1.5% │ 44.5 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 26 │ 1.0.0 │ cluster │ 21702 │ online │ 0 │ 22s │ 1.9% │ 44.4 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 27 │ 1.0.0 │ cluster │ 21709 │ online │ 0 │ 22s │ 1.7% │ 42.6 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 28 │ 1.0.0 │ cluster │ 21720 │ online │ 0 │ 22s │ 1.5% │ 42.7 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 29 │ 1.0.0 │ cluster │ 21731 │ online │ 0 │ 22s │ 3% │ 42.7 MB │ tomcat │ disabled │
└────────────────┴────┴─────────┴─────────┴───────┴────────┴─────────┴────────┴──────┴───────────┴────────┴──────────┘ then I use this same command ┌────────────────┬────┬─────────┬─────────┬───────┬────────┬─────────┬────────┬──────┬───────────┬────────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├────────────────┼────┼─────────┼─────────┼───────┼────────┼─────────┼────────┼──────┼───────────┼────────┼──────────┤
│ NODE-RRD-PC-v1 │ 25 │ 1.0.0 │ cluster │ 25414 │ online │ 83 │ 0s │ 0% │ 39.3 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 26 │ 1.0.0 │ cluster │ 25407 │ online │ 83 │ 0s │ 0% │ 43.5 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 27 │ 1.0.0 │ cluster │ 22179 │ online │ 7 │ 68s │ 0.2% │ 43.5 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 28 │ 1.0.0 │ cluster │ 25421 │ online │ 79 │ 0s │ 0% │ 34.4 MB │ tomcat │ disabled │
│ NODE-RRD-PC-v1 │ 29 │ 1.0.0 │ cluster │ 25400 │ online │ 76 │ 0s │ 0% │ 47.5 MB │ tomcat │ disabled │
└────────────────┴────┴─────────┴─────────┴───────┴────────┴─────────┴────────┴──────┴───────────┴────────┴──────────┘ and 25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: Error: listen EADDRINUSE :::9013
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at Server.setupListenHandle [as _listen2] (net.js:1286:14)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at listenInCluster (net.js:1334:12)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at Server.listen (net.js:1421:7)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at LeekKoaApplication.listen (/opt/app/node-rrd-pc/node_modules/koa/lib/application.js:65:19)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at LeekApp.run (/opt/app/node-rrd-pc/node_modules/leekjs/core/LeekApp.js:195:33)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at process._tickCallback (internal/process/next_tick.js:68:7)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at startup (internal/bootstrap/node.js:285:19)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: [uncaughtException] { Error: listen EADDRINUSE :::9013
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at Server.setupListenHandle [as _listen2] (net.js:1286:14)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at listenInCluster (net.js:1334:12)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at Server.listen (net.js:1421:7)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at LeekKoaApplication.listen (/opt/app/node-rrd-pc/node_modules/koa/lib/application.js:65:19)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at LeekApp.run (/opt/app/node-rrd-pc/node_modules/leekjs/core/LeekApp.js:195:33)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at process._tickCallback (internal/process/next_tick.js:68:7)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at startup (internal/bootstrap/node.js:285:19)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: errno: 'EADDRINUSE',
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: code: 'EADDRINUSE',
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: syscall: 'listen',
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: address: '::',
25|NODE-RRD-PC-v1 | 2019-01-08 16:07 +08:00: port: 9013 }
PM2 | App [NODE-RRD-PC-v1:25] exited with code [1] via signal [SIGINT]
PM2 | App [NODE-RRD-PC-v1:25] starting in -fork mode-
PM2 | App [NODE-RRD-PC-v1:25] online my {
"apps" : [
{
"name" : "NODE-RRD-PC-v1",
"script" : "index.js",
"args" : [],
"node_args" : "--harmony",
"merge_logs" : true,
"error_file" : "pm2.error.log",
"out_file" : "pm2.out.log",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"instances" : 5,
"exec_mode" : "cluster",
"cwd" : ".",
"max_memory_restart" : "200M",
"env": {
"NODE_ENV": "production"
},
"env_development": {
"NODE_ENV": "development"
},
"env_production" : {
"NODE_ENV": "production"
},
"env_qa" : {
"NODE_ENV": "qa"
},
"env_stage" : {
"NODE_ENV" : "stage"
}
}
]
} |
It seems, when I run PM2 | App [NODE-RRD-PC-v1:0] starting in -cluster mode-
PM2 | App [NODE-RRD-PC-v1:0] online
PM2 | App [NODE-RRD-PC-v1:1] starting in -cluster mode-
PM2 | App [NODE-RRD-PC-v1:1] online
PM2 | App [NODE-RRD-PC-v1:2] starting in -cluster mode-
PM2 | App [NODE-RRD-PC-v1:2] online
PM2 | App [NODE-RRD-PC-v1:3] starting in -cluster mode-
PM2 | App [NODE-RRD-PC-v1:3] online
PM2 | App [NODE-RRD-PC-v1:4] starting in -cluster mode-
PM2 | App [NODE-RRD-PC-v1:4] online But when I run PM2 | App [NODE-RRD-PC-v1:1] exited with code [1] via signal [SIGINT]
PM2 | App [NODE-RRD-PC-v1:1] starting in -fork mode-
PM2 | App [NODE-RRD-PC-v1:1] online
PM2 | App [NODE-RRD-PC-v1:2] exited with code [1] via signal [SIGINT]
PM2 | App [NODE-RRD-PC-v1:2] starting in -fork mode-
PM2 | App [NODE-RRD-PC-v1:2] online
PM2 | App [NODE-RRD-PC-v1:3] exited with code [1] via signal [SIGINT]
PM2 | App [NODE-RRD-PC-v1:3] starting in -fork mode-
PM2 | App [NODE-RRD-PC-v1:3] online |
If anyone is still having this issue, please reference this ticket: #3946 You need to set exec_mode to "cluster_mode" not "cluster" if you want cluster mode. |
What's going wrong?
App only works on fork mode. Listens on port but is unable to spawn other instances. I'm out of ideas where the cause is... already tried via command line same issue when trying cluster mode.
Configuration is as follows:
Supporting information
Please run the following command (available on PM2 >= 2.6)
The text was updated successfully, but these errors were encountered: