-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
2 step plan to fix most DNS-related issues in Bun #10731
Comments
Starting a few hours ago all my
My workaround so far has been to use Node.js as my base image in my Dockerfile:
Is there a better workaround? |
I don't know if this is related but prisma does not work on bun if node is not installed. pretty sure |
my issue has been solved since 1.1.9 and 1.1.10 releases. Thanks everyone. |
This was completed some time ago |
There are many issues related to IPv4 vs IPv6 where Bun seemingly takes forever to send a network request that should be almost instant.
This impacts
bun install
,fetch()
,node:http
, and pretty much anywhere making an outgoing HTTP request. It doesn't impact most users, but it does impact many.I think there are two causes:
getaddrinfo
is blockingI think these are two separate projects.
Make getaddrinfo non-blocking
We already have code to do this, so it should be the easiest part here. We need to separate out the JavaScript bindings from the DNS code into something we can use for both JavaScript and Zig. That means it needs to not depend on a
JSC.VirtualMachine
.On macOS, we can use
libinfo
, on Windows,uv_getaddrinfo
, and on Linux,libc
getaddrinfo in a thread pool. Having 3 different implementations sounds like it'd be complicated but we already wrote the code to do this for the JS bindings so it's not actually much more work to wire it up tohttp.zig
.This will have the most impact on Docker & Linux, where
getaddrinfo
is not cached by default (macOS caches it). Like with the JavaScript bindings, we should have a cache to dedupe duplicate in-flight DNS queries. This handles making multiplefetch
calls concurrently to the same host. Instead of 5 calls through getaddrinfo(), we only need to make one call.#10728 is a small way to start this project, but I do not think I have the time to do this myself
Implement Happy Eyeballs v2
Happy Eyeballs is essentially:
I think this will reliably fix the issues where something can connect successfully in Node but not in Bun.
I expect this to be a little trickier to implement. Roughly how I'd do it is:
*next
ptr to denote what are the other sockets its associated withWe can probably rely on the existing socket timeout code to handle timeouts.
Related issues: (TODO: add more)
fetch()
is localhost #1425The text was updated successfully, but these errors were encountered: