workerd icon indicating copy to clipboard operation
workerd copied to clipboard

🐛 BUG: warning always received about multiple bind addresses

Open Cherry opened this issue 3 years ago • 8 comments

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.8.0

What version of Node are you using?

18.17.1

What operating system are you using?

Windows 10

Describe the Bug

Every time that you start wrangler dev, you get a large red error like so (from workerd it would seem):

kj/async-io-win32.c++:982: warning: Bind address resolved to multiple addresses.  Only the first address will be used.  If this is incorrect, specify the address numerically.  This may be fixed in the future.; addrs[0].toString() = 127.0.0.1:59208

It's possible that this only occurs in Windows, or when a machine has multiple network adapters. Hitting b still works fine, and opening up http://127.0.0.1:8787/ is fine too, so perhaps the error should just be hidden?

Reproduction steps

  • npm create cloudflare@latest
  • use all defaults
  • cd into worker dir and run npm start

Cherry avatar Sep 13 '23 21:09 Cherry

I was installing PartyKit.io that uses cf and got the same error.

Windows 10

image

edge-rps avatar Sep 15 '23 23:09 edge-rps

Same error

Windows 11

Ekran görüntüsü 2023-09-17 235454

goktugcy avatar Sep 17 '23 20:09 goktugcy

Same here.

image Windows 10

Multiple ips provided, but no one seems to be working.

[EDIT] When I tried Astro's guide, the error appeared, and no URL was working. https://docs.astro.build/en/guides/integrations-guide/cloudflare

Starting it with 'npm create cloudflare@latest' made that work despite the errors, but not loading env vars to Astro.locals.runtime. https://developers.cloudflare.com/workers/get-started/guide/

william0bra avatar Sep 26 '23 19:09 william0bra

This also appears every single time the server reloads too.

Cherry avatar Sep 27 '23 22:09 Cherry

Found a quick fix of the above for win10.

Use wrangler with parameter: --ip=127.0.0.1 to specify exact ip to bind.

genesem avatar Oct 12 '23 12:10 genesem

Found a quick fix of the above for win10.

Use wrangler with parameter: --ip=127.0.0.1 to specify exact ip to bind.

I still get the error, but its acting like there is only one address, so rebuilds work now. Thanks 👍

ghost avatar Oct 17 '23 16:10 ghost

I suspect this is because localhost maps to two addresses -- one ipv4 (127.0.0.1) and one ipv6 (::1). workerd is telling you that it doesn't know how to listen on both addresses at once, so it chose to listen only to the ipv4 address.

This isn't a big deal in practice because everything trying to connect to "localhost" will almost certainly use the first address first, which is the one workerd bound to, so things will just work fine.

That said, it turns out I actually fixed this on the Unix side a while ago: https://github.com/capnproto/capnproto/commit/f812158982f497e5eb0a8ca5ab286097b3d31367

But I didn't update async-io-win32.c++. If someone makes the same change to async-io-win32.c++ as was made to async-io-unix.c++ in that commit, it should allow workerd to bind to both IPs at once.

kentonv avatar Nov 13 '23 18:11 kentonv

This should be fixed in the next release.

1000hz avatar Dec 09 '23 00:12 1000hz