Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught AddrInUse: when using --unstable --watch #7824

Closed
rizrmd opened this issue Oct 4, 2020 · 8 comments
Closed

Uncaught AddrInUse: when using --unstable --watch #7824

rizrmd opened this issue Oct 4, 2020 · 8 comments

Comments

@rizrmd
Copy link

rizrmd commented Oct 4, 2020

I tried running simple web server on deno latest:

import { serve } from 'https://deno.land/std/http/server.ts';
const s = serve({ port: 8000 });
console.log('http://localhost:8000/');
for await (const req of s) {
  const file = await Deno.create('f.txt');
  await Deno.copy(req.body, file);
  req.respond({ body: 'Hello  asd asWorld\n' });
}

when I saved some changes, file watcher is restarting my app, and then error:

Watcher File change detected! Restarting!
error: Uncaught AddrInUse: Only one usage of each socket address (protocol/network address/port) is normally permitted. (os error 10048)
    at Object.jsonOpSync (core.js:247:13)
    at opListen (deno:cli/rt/30_net.js:32:17)
    at Object.listen (deno:cli/rt/30_net.js:207:17)
    at Object.listen (deno:cli/rt/40_net_unstable.js:11:18)
    at serve (https://deno.land/std@0.73.0/http/server.ts:287:25)
    at <file:///C:/Users/Riz/Desktop/a/a.ts>:2:1
Watcher Process terminated! Restarting on file change...

I am on windows 10,

@mohammadhonarvar
Copy link

I'm using windows 10 too and i have the same problem.
Can somebody help us?

@fzn0x
Copy link
Contributor

fzn0x commented Oct 12, 2020

I'm also getting this issue by Oak Server , windows 10 , can somebody help?

@magurotuna
Copy link
Member

@rizkyramadhan @mohammadhonarvar @fauzan121002
Do this error still happen to you all when using Deno v1.6.0? If so, I'll dig into it.

@stefanreimers
Copy link

@magurotuna
I can confirm this is still happening in v1.6.0.
Environment is Windows 10.

Script is

import { serve } from "https://deno.land/std@0.80.0/http/server.ts";
const s = serve({ port: 8000 });

for await (const req of s) {
  req.respond({ body: "Hello World\n" });
}

Call is:

deno run --allow-net --unstable --watch server.ts

Any change to the script while in watch mode causes the server to crash.

@magurotuna
Copy link
Member

@stefanreimers Thanks for the info! I'll look into it although it seems to be a window specific issue and I don't have a window machine.

@mohammadhonarvar
Copy link

By upgrade to version 1.7.0, this issue solved.
Thanks DENO team.

@jtoppine
Copy link

jtoppine commented Nov 9, 2022

Encountering the same issue on the latest version.

Script is simply:

Deno.serve((_request) => {
    return new Response("Hello world!");
});

Call is:

deno run --watch --unstable --allow-net serve.js

When modifying the script triggering the watcher restart, following error happens:

Uncaught (in promise) AddrInUse: Only one usage of each socket address (protocol/network address/port) is normally permitted. (os error 10048)

Deno 1.27.2 on Windows 10

@bartlomieju
Copy link
Member

@jtoppine your problem is tracked in #16267

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

No branches or pull requests

8 participants