mirror of
https://github.com/imputnet/cobalt.git
synced 2026-05-22 14:24:23 -05:00
EADDRINUSE error when running multiple API instances #566
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @userlip on GitHub (Nov 14, 2024).
bug description
When starting the API instance with more than 1 instance in the .env it will end up with a EADDRINUSE error
`
pnpm start
[✓] cobalt sub-instance running on 127.0.0.1:40323
[✓] cobalt sub-instance running on 127.0.0.1:35095
[✓] cobalt sub-instance running on 127.0.0.1:36197
[✓] cobalt sub-instance running on 127.0.0.1:43077
[✓] cobalt sub-instance running on 127.0.0.1:45071
[✓] cobalt sub-instance running on 127.0.0.1:45375
[✓] cobalt sub-instance running on 127.0.0.1:34861
node:events:496
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::3001
at Server.setupListenHandle [as _listen2] (node:net:1907:16)
at listenInCluster (node:net:1964:12)
at Server.listen (node:net:2066:7)
at runAPI (file:///home/ploi/cobalt/api/src/core/api.js:350:28)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1943:8)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3001
}
Node.js v22.11.0
[✓] cobalt sub-instance running on 127.0.0.1:43537
[✓] cobalt sub-instance running on 127.0.0.1:42271
ELIFECYCLE Command failed with exit code 1.
`
reproduction steps
API_URL="https://cobalt.test.com/"
API_PORT=3001
API_INSTANCE_COUNT=10
API_REDIS_URL=redis://localhost:6379
screenshots
No response
links
No response
platform information
Ubuntu 24.04
additional context
No response
@wukko commented on GitHub (Nov 14, 2024):
this means that something else uses the 3001 port on your machine and cobalt can’t use it. try a different port or free up the 3001 port.
@userlip commented on GitHub (Nov 14, 2024):
I actaully checked that before, and that is not the case:
netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN 1541/systemd-resolv
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 1541/systemd-resolv
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN 1713/mysqld
tcp 0 0 0.0.0.0:10004 0.0.0.0:* LISTEN 1025878/php
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 3200917/docker-prox
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 1418825/redis-serve
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2068/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2068/nginx: master
tcp 0 0 127.0.0.1:8461 0.0.0.0:* LISTEN 1587/python3
tcp6 0 0 :::3306 :::* LISTEN 1713/mysqld
tcp6 0 0 :::443 :::* LISTEN 2068/nginx: master
tcp6 0 0 :::80 :::* LISTEN 2068/nginx: master
tcp6 0 0 :::22 :::* LISTEN 1/init
@dumbmoron commented on GitHub (Nov 14, 2024):
@userlip
your node version is out of date
@dumbmoron commented on GitHub (Nov 14, 2024):
if you wish to use API_INSTANCE_COUNT, you need to use the latest node (as mentioned in docs):
160160704d/docs/run-an-instance.md (L81)@userlip commented on GitHub (Nov 14, 2024):
yeap you are right, sorry for the troubles!