Nodes crashing when address is already used
Closed this issue ยท 7 comments
Some nodes crash if address or port already used. I can't interact with them and when trying to open wallet inside in browser it simply not responding. So far there's no interface to restart them with different address.
Errors in log
2.719 [n1] stderr 2022-12-04T12:47:55.675Z ilp-protocol-ildcp received client info. clientAddress=test.das.stub.n1.VXzHn5 assetScale=9 assetCode=XRP
2.802 [n1] stderr node:events:491
2.802 [n1] stderr throw er; // Unhandled 'error' event
2.802 [n1] stderr ^
2.802 [n1] stderr
2.802 [n1] stderr Error: listen EADDRINUSE: address already in use :::5000
2.802 [n1] stderr at __node_internal_captureLargerStackTrace (node:internal/errors:484:5)
2.802 [n1] stderr at __node_internal_uvExceptionWithHostPort (node:internal/errors:583:12)
2.802 [n1] stderr at Server.setupListenHandle [as _listen2] (node:net:1485:16)
2.802 [n1] stderr at listenInCluster (node:net:1533:12)
2.802 [n1] stderr at Server.listen (node:net:1621:7)
2.802 [n1] stderr at new WebSocketServer (/Users/radhy/Documents/@proyek/dassie/node_modules/.pnpm/ws@8.10.0/node_modules/ws/lib/websocket-server.js:97:20)
2.802 [n1] stderr at runDebugRpcServer (/Users/radhy/Documents/@proyek/dassie/packages/app-dev/src/runner/effects/debug-rpc-server.ts:55:15)
2.802 [n1] stderr at loopEffect (/Users/radhy/Documents/@proyek/dassie/packages/lib-reactive/src/reactor.ts:122:28)
2.802 [n1] stderr at Reactor.use (/Users/radhy/Documents/@proyek/dassie/packages/lib-reactive/src/reactor.ts:42:9)
2.802 [n1] stderr at EffectContext.run (/Users/radhy/Documents/@proyek/dassie/packages/lib-reactive/src/effect.ts:150:25)
2.802 [n1] stderr at debugRunner (/Users/radhy/Documents/@proyek/dassie/packages/app-dev/src/runner/launchers/node:31:7)
2.802 [n1] stderr at async loopEffect (/Users/radhy/Documents/@proyek/dassie/packages/lib-reactive/src/reactor.ts:124:7)
2.802 [n1] stderr Emitted 'error' event on WebSocketServer instance at:
2.802 [n1] stderr at Server.emit (node:events:513:28)
2.802 [n1] stderr at emitErrorNT (node:net:1512:8)
2.802 [n1] stderr at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
2.802 [n1] stderr code: 'EADDRINUSE',
2.802 [n1] stderr errno: -48,
2.802 [n1] stderr syscall: 'listen',
2.802 [n1] stderr address: '::',
2.802 [n1] stderr port: 5000
2.802 [n1] stderr }
2.802 [n1] stderr
2.802 [n1] stderr Node.js v18.12.1
Had same experience
@ProgNovel
Are you on MacOS perchance ?
@ProgNovel
Are you on MacOS perchance ?
Yes. Does this perhaps have something to do with the error?
Perhaps. It happens at times.
I believe @justmoon is using linux
Right now the development environment uses a lot of ports and it does assume that they are all available. For me it's not an issue because I use a VM for my dev environment so all ports are always available.
The way I see it, we could either:
- Add functionality to the dev environment to dynamically choose ports that are available (only port 443 would be required)
- Make it easy to spin up the dev environment in a VM or some kind of container-based setup
Option 1 is probably more aligned with how the dev environment works right now. But I'm open to other ideas.
I think MacOS is using port 5000 by default these days
โ supertokens-website git:(master) โ lsof -i 4tcp:5000 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 497 nicholasdudfield 7u IPv4 0xb9955e3eb39fe837 0t0 TCP *:commplex-main (LISTEN)
โ supertokens-website git:(master) โ ps -ef | grep 497
501 497 1 0 Thu01PM ?? 1:46.78 /System/Library/CoreServices/ControlCenter.app/Contents/MacOS/ControlCenter
See also (haven't read it fully, but seems pertinent): https://developer.apple.com/forums/thread/682332
Just changing to 5001 is probably a good start:
export const NODES_DEBUG_START_PORT = 5001