Unitech / Unitech/pm2

Port address already in use error.

Open
#5,889 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

I'm reading the documentation but can not find what requirements does an application need to meet in order to be managed by PM2 in cluster mode?

I'm trying to run 'gatsby serve' in cluster mode, but when attempting to 'reload' the application, I see errors in the logs related to the port already being in use:

Error: listen EADDRINUSE: address already in use 127.0.0.1:9000
    at Server.setupListenHandle [as _listen2] (node:net:1330:16)
    at listenInCluster (node:net:1378:12)
    at GetAddrInfoReqWrap.doListen (node:net:1516:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:73:8)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1357:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '127.0.0.1',
  port: 9000
}

The application doesn't start after reload command, but PM2 shows the status as "online," which is incorrect.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing gatsby serve under PM2 cluster mode, then run a reload and inspect the reported EADDRINUSE logs alongside PM2's online status. Done means the application reloads without the port conflict, or PM2 accurately reports the failed application state.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.