-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fetch()
hangs and fails randomly with HTTPS URLs
#7260
Comments
have you verified your internet does not have issues? are you able to reproduce similar issues in node.js? |
fetch()
hangs and fails randomlyfetch()
hangs and fails randomly with HTTPS URLs
Yes, node testsconsole.log(
"https://example.com",
await fetch("https://example.com").then((x) => x.status)
);
|
Also experiencing this |
@Jarred-Sumner this looks like a critical issue, let me know if I can help any way other than diving into bun code To reproduce:OS: MacOS 14.1 (M1 chip) Host https endpoint that returns 200 with 6 minutes delay, for example:
Run this code with bun:
Expected resultStatus code logged out after 6 minutes Actual resultNo output |
I believe I'm seeing this too? I'm just trying to use axios to make a web request and it's just hanging every time I try to do it in bun. I swap over to just running the file with node and it succeeds immediately. Very bizarre. I'm running on an M2 Macbook. What's super weird is that I think at first it succeeded a few times. Then as I continue to run the script several times it would lock up every other time or so. Now it just fails every time I run it. I was initially running on v1.0.14. I tried upgrading to v1.0.22 just to see if it fixed anything, but it didn't. I also tried going all the way back to v1.0.4 and it still failed. |
We hit this bug many times on production and it made many npm library not useable like twilio |
Is there any update on this? This feels like a very basic need for most devs. We are also experincing the exact same problem when using an external library which relies on axios under the hood. |
+1, we're experiencing this too when hitting HTTPS endpoints with Bun's
Edit: this is only happening for |
I suspect it's something related to IPv6 vs IPv4. We haven't implemented "happy eyeballs" yet |
Yes, seems to be something with IPv6... On our team, all of us were having issues with axios hanging intermittently. Then we switched to fetch and instead of hanging we were getting the Also fortunately, we aren't experiencing these errors in our live environment (digitalocean k8s cluster). So I have no idea how that helps with the root cause of this but thought I would share in case it can help get some people unstuck. |
We are also having this issue with axios. A random number of axios get requests will get through and then it will just not work anymore. |
Likewise, seeing the same issue, resolved with switching back to node |
Not sure if this will help anyone but in our case we realised that the issue lied in the https agent which was actually injected by Sentry, related to what is reported in #5091. In our case the solution was to amend the Sentry.init function by adding Sentry.init({
...
integrations: (int) => int.filter((i) => !['Http'].includes(i.name)),
}) |
Here's a workaround I'm using with
|
Unable to reproduce. Dropping some benchmarks. Here's various iterations of running the above snippet on a M2 Mac. Normal run, no weird high outliers, hyperfine automatic run count: ➜ sandbox hyperfine "bun run index.ts" --warmup 1
Benchmark 1: bun run index.ts
Time (mean ± σ): 9.8 ms ± 0.6 ms [User: 5.9 ms, System: 4.4 ms]
Range (min … max): 8.5 ms … 11.4 ms 229 runs Disabled ipv6, verified https://ip.me/ reported an ipv4 address, and tried again w/ high hyperfine run count: ➜ sandbox hyperfine "bun run index.ts" --warmup 1 --runs 5000
Benchmark 1: bun run index.ts
Time (mean ± σ): 9.7 ms ± 0.7 ms [User: 6.0 ms, System: 4.4 ms]
Range (min … max): 8.1 ms … 17.1 ms 5000 runs Reenabled ipv6, verified https://ip.me reported an ipv6 address, and tried again w/ high hyperfine run count: ➜ sandbox hyperfine "bun run index.ts" --warmup 1 --runs 5000
Benchmark 1: bun run index.ts
Time (mean ± σ): 9.5 ms ± 0.6 ms [User: 5.9 ms, System: 4.4 ms]
Range (min … max): 8.0 ms … 14.0 ms 5000 runs No meaningful conclusions other than concluding that the local ipv4/ipv6 switch in MacOS network settings doesn't seem to be a viable means to reproduce. |
I'm also being affected by this. On a mac m1 using the twilio sdk. |
Able to reproduce with |
Pretty sure this is fixed due to a combination of happy eyeballs and #11849 and related PRs If you're still running into this after Bun v1.1.12 or so, please leave a comment and we'll re-open |
What version of Bun is running?
1.0.13+f5bf67bd1
What platform is your computer?
Linux 6.6.1-arch1-1 x86_64 unknown
What steps can reproduce the bug?
Making any
fetch()
call with an HTTPS request can cause the bug.What is the expected behavior?
Instant fetch requests, like happens when using raw HTTP:
show/hide full console log
What do you see instead?
Fetch requests can be slow and fail after a while:
show/hide full console log
Additional information
No response
The text was updated successfully, but these errors were encountered: