deno: Used port is not freed when using Deno.run with --watch
When running this code
Deno.serve(() => {}, { port: x })
with this command
deno run -A --unstable --watch script.ts
I get this error everytime i make a change and have to kill the script (ctrl + c) and run it again.
Watcher File change detected! Restarting!
error: Uncaught (in promise) AddrInUse: Address already in use (os error 98)
Watcher Process finished. Restarting on file change...
deno 1.26.1 (release, x86_64-unknown-linux-gnu) Linux Fedora 37
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 19 (1 by maintainers)
Commits related to this issue
- fix(ext/flash): graceful server startup/shutdown (#16383) Fixes https://github.com/denoland/deno/issues/16267 Co-authored-by: Yusuke Tanaka <yusuktan@maguro.dev> — committed to denoland/deno by littledivy 2 years ago
- fix(ext/flash): graceful server startup/shutdown (#16383) Fixes https://github.com/denoland/deno/issues/16267 Co-authored-by: Yusuke Tanaka <yusuktan@maguro.dev> — committed to bartlomieju/deno by littledivy 2 years ago
You can get around this by adding an
AbortController
(which might be a good idea in general):Yeah this isn’t fixed on 1.31.3 for the built-in
Deno.serve
.Could this issue be re-opened? The problem is still present for me with
deno 1.30.3 (release, aarch64-apple-darwin)
. It looks like there was some back-and-forth with reverted PRs—did a fix ever get merged and released?This problem is happening in 1.31.2 as well in Windows computers (only arch we were able to reproduce)
Seeing this on
1.37.0
usingDeno.serve
.It happens intermittently which perhaps suggests a race condition.
Fixed by https://github.com/denoland/deno/pull/18568
Issue seems to be fixed at deno 1.31.3 without needing the above workaround