Comments (5)
You posted a lot of source code snippets but did not actually describe the issue you are having.
from pm2.
@ultimate-tester
I am having a problem running it in cluster mode. While the mode is working, I do not have any error logs, only information indicating that there is an error with the instance running in cluster mode.
from pm2.
Is that message appearing when you do pm2 logs
? Or else, where do you see it?
Could it be that this happens because your script is completing/terminating? It doesn't seem to have any functionality that needs to be clustered.
from pm2.
root@docker-desktop /s/a/v1# pm2 flush && pm2 start ecosystem.config.cjs
[PM2] Flushing /root/.pm2/pm2.log
[PM2] Logs flushed
[PM2][WARN] Applications index not running, starting...
[PM2] App [index] launched (8 instances)
┌────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ index │ default │ N/A │ cluster │ 6167 │ 0s │ 1 │ online │ 0% │ 46.9mb │ root │ enabled │
│ 1 │ index │ default │ N/A │ cluster │ 6178 │ 0s │ 1 │ online │ 0% │ 49.6mb │ root │ enabled │
│ 2 │ index │ default │ N/A │ cluster │ 6196 │ 0s │ 1 │ online │ 0% │ 0b │ root │ enabled │
│ 3 │ index │ default │ N/A │ cluster │ 6132 │ 0 │ 1 │ stopped │ 0% │ 0b │ root │ enabled │
│ 4 │ index │ default │ N/A │ cluster │ 6143 │ 0s │ 0 │ online │ 0% │ 0b │ root │ enabled │
│ 5 │ index │ default │ N/A │ cluster │ 6150 │ 0s │ 0 │ online │ 0% │ 51.9mb │ root │ enabled │
│ 6 │ index │ default │ N/A │ cluster │ 6161 │ 0s │ 0 │ online │ 0% │ 48.9mb │ root │ enabled │
│ 7 │ index │ default │ N/A │ cluster │ 6190 │ 0s │ 0 │ online │ 0% │ 45.6mb │ root │ enabled │
└────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
root@docker-desktop /s/a/v1# pm2 list
┌────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 1 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 2 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 3 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 4 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 5 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 6 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
│ 7 │ index │ default │ N/A │ cluster │ 0 │ 0 │ 15 │ errored │ 0% │ 0b │ root │ enabled │
└────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
root@docker-desktop /s/a/v1# pm2 logs
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/root/.pm2/pm2.log last 15 lines:
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:4 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:4] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:3 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:3] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:6 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:6] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:5 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:5] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
PM2 | 2024-03-21T18:18:56: PM2 log: App name:index id:7 disconnected
PM2 | 2024-03-21T18:18:56: PM2 log: App [index:7] exited with code [0] via signal [SIGINT]
PM2 | 2024-03-21T18:18:56: PM2 log: Script /usr/bin/bash had too many unstable restarts (16). Stopped. "errored"
/root/.pm2/logs/index-out-0.log last 15 lines:
/root/.pm2/logs/index-error-0.log last 15 lines:
/root/.pm2/logs/index-out-1.log last 15 lines:
/root/.pm2/logs/index-error-1.log last 15 lines:
/root/.pm2/logs/index-out-2.log last 15 lines:
/root/.pm2/logs/index-error-2.log last 15 lines:
/root/.pm2/logs/index-out-3.log last 15 lines:
/root/.pm2/logs/index-error-3.log last 15 lines:
/root/.pm2/logs/index-out-4.log last 15 lines:
/root/.pm2/logs/index-error-4.log last 15 lines:
/root/.pm2/logs/index-out-5.log last 15 lines:
/root/.pm2/logs/index-error-5.log last 15 lines:
/root/.pm2/logs/index-out-6.log last 15 lines:
/root/.pm2/logs/index-error-6.log last 15 lines:
/root/.pm2/logs/index-out-7.log last 15 lines:
/root/.pm2/logs/index-error-7.log last 15 lines:
^C⏎
root@docker-desktop /s/a/v1 [SIGINT]# pm2 logs --err
[TAILING] Tailing last 15 lines for [all] processes (change the value with --lines option)
/root/.pm2/logs/index-error-0.log last 15 lines:
/root/.pm2/logs/index-error-1.log last 15 lines:
/root/.pm2/logs/index-error-2.log last 15 lines:
/root/.pm2/logs/index-error-3.log last 15 lines:
/root/.pm2/logs/index-error-4.log last 15 lines:
/root/.pm2/logs/index-error-5.log last 15 lines:
/root/.pm2/logs/index-error-6.log last 15 lines:
/root/.pm2/logs/index-error-7.log last 15 lines:
Or another way, do you have any JS script that works with cluster mode? Can you share the repository with me, including the package.json file?
from pm2.
Code 0 is a normal successful program end, which I'd expect from the code you provided.
The cluster mode is meant to automatically share a listening port between all nodes in the cluster. For example if you setup an express server and want to load balance between multiple nodes. So perhaps the sample code of express might be a good test. Another example would be if you have built a (queue) worker. In any case scripts that keep running because they are listening on a port or waiting for an event to happen.
from pm2.
Related Issues (20)
- use cnpm install -g pm2 show error tip
- NextJS 13/14 app router fails with cluster mode with SIGINT HOT 1
- Vulnerability detected in dependent library Braces (CWE-400) HOT 1
- Snyk Package Analysis - Inflight Missing Release of Resource after Effective Lifetime Vulnerability
- migrate to bun HOT 6
- How to use `--wait-ready` for non node-js programs ? HOT 1
- pm2 start (at time) HOT 3
- Interpreter bun not working with multiple instances an cluster HOT 1
- PM2 loses connection with Keymetrics on system reboot HOT 1
- set 'content-length' and 'transfer-encoding:gzip' for 'pm2 serve'
- Try catch blocks cause the pm2 app to crash when an exception is caught. HOT 2
- pm2 logs do not print realtime on M2 Pro HOT 1
- use pm2 start index.ts occur Error HOT 1
- Question regarding logging :question: HOT 1
- Critical error on compatibility with pm2 on automatically start service on system startup cases HOT 1
- Sudden PM2 core dump. Asking for assistance in finding the root cause, if possible. HOT 2
- `pm2 logs` with a namespace doesn't work if run before relevant `pm2 start`
- ***Urgent***: GNU-AGPL License Concerns HOT 1
- https://id.keymetrics.io/api/oauth/register not loading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pm2.