Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

dev-runner leaves sockets in use after quitting #3

Open
AtkinsSJ opened this issue Feb 29, 2024 · 2 comments
Open

dev-runner leaves sockets in use after quitting #3

AtkinsSJ opened this issue Feb 29, 2024 · 2 comments

Comments

@AtkinsSJ
Copy link
Contributor

I'm running on Linux, and this happens a bit inconsistently for me.

Steps:

  1. dev-runner ./run-phoenix-http.json5
  2. Enter stop to shut it down
  3. Wait until all node processes related to it have exited
  4. dev-runner ./run-phoenix-http.json5 again
  5. See errors in the log about the addresses being in use.
❯ dev-runner ./run-phoenix-http.json5

src/main.js → dist/bundle.js...
created dist/bundle.js in 602ms

src/main_puter.js → dist/bundle.js...
created dist/bundle.js in 516ms
[term.http:err] node:events:497
[term.http:err]       throw er; // Unhandled 'error' event
[term.http:err]       ^
[term.http:err] 
[term.http:err] Error: listen EADDRINUSE: address already in use 0.0.0.0:8082
[term.http:err]     at Server.setupListenHandle [as _listen2] (node:net:1893:16)
[term.http:err]     at listenInCluster (node:net:1941:12)
[term.http:err]     at doListen (node:net:2096:7)
[term.http:err]     at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
[term.http:err] Emitted 'error' event on Server instance at:
[term.http:err]     at emitErrorNT (node:net:1920:8)
[term.http:err]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[term.http:err]   code: 'EADDRINUSE',
[term.http:err]   errno: -98,
[term.http:err]   syscall: 'listen',
[term.http:err]   address: '0.0.0.0',
[term.http:err]   port: 8082
[term.http:err] }
[term.http:err] 
[term.http:err] Node.js v21.6.2
[term.http] STOPPED
[shell.rollup:err] rollup v3.21.4
[shell.rollup:err] bundles src/main_puter.js → dist/bundle.js...
[term.rollup:err] rollup v3.23.0
[term.rollup:err] bundles src/main.js → dist/bundle.js...
[shell.http:err] node:events:497
[shell.http:err]       throw er; // Unhandled 'error' event
[shell.http:err]       ^
[shell.http:err] 
[shell.http:err] Error: listen EADDRINUSE: address already in use 0.0.0.0:8080
[shell.http:err]     at Server.setupListenHandle [as _listen2] (node:net:1893:16)
[shell.http:err]     at listenInCluster (node:net:1941:12)
[shell.http:err]     at doListen (node:net:2096:7)
[shell.http:err]     at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
[shell.http:err] Emitted 'error' event on Server instance at:
[shell.http:err]     at emitErrorNT (node:net:1920:8)
[shell.http:err]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
[shell.http:err]   code: 'EADDRINUSE',
[shell.http:err]   errno: -98,
[shell.http:err]   syscall: 'listen',
[shell.http:err]   address: '0.0.0.0',
[shell.http:err]   port: 8080
[shell.http:err] }
[shell.http:err] 
[shell.http:err] Node.js v21.6.2
[shell.http] STOPPED

After doing the same again, I only had the :8080 server fail to start. Then a third time, they both succeeded. But it definitely varies.

@KernelDeimos
Copy link
Collaborator

A few things come to mind:

  • Although stop and Ctrl+C should be the same, I think I've only observed this once or twice and I usually use Ctrl+C
  • This might be an issue in dev-runner itself

@AtkinsSJ
Copy link
Contributor Author

AtkinsSJ commented Mar 7, 2024

A workaround might be to scan for available ports (like the Puter dev server does) instead of hard-coding them. That doesn't fix this issue, but would make it less of a problem, and would generally be good to do as we don't know what ports someone's system might be using already.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants