1

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?

Zakaria Ahmed
  • 54
  • 2
  • 7
  • 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. – jfriend00 Feb 13 '23 at 03:17
  • @jfriend00 I am using a2hosting's shared hosting. I set up the app by following Method #1 of [this](https://www.a2hosting.com/kb/cpanel/cpanel-software/create-application-with-nodejs-selector). I don't know how they start the process. – Zakaria Ahmed Feb 14 '23 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... – jfriend00 Feb 14 '23 at 22:34

0 Answers0