2

I have a simple Node.js express app that just serves some static files.

const express = require('express');
const cors = require('cors')

const app = express();

app.use(cors())
app.use(express.static('media'));

app.listen();

But the app keeps running multiple processes, more than 20. I am running 3 similar apps(and other apps) on a shared hosting service and each of these creates multiple processes. Sometimes these exceed the max process count of the hosting server, which prevents the other apps to work properly. What can I do to fix this issue?

3
  • nodejs by itself and with express only creates one process so this must have something to do with how you are starting the process, not with the code you show here. Commented Feb 13, 2023 at 3:17
  • @jfriend00 I am using a2hosting's shared hosting. I set up the app by following Method #1 of this. I don't know how they start the process. Commented Feb 14, 2023 at 19:06
  • It may be useful to find where errors are logged to and see what error is happening that is leading to the restart. I would guess you're getting some error that causes the process to exit with an error code that causes the hosting environment to restart your app which leads to the error which leads to the restart, etc... Commented Feb 14, 2023 at 22:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.