-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Consuming certain HTTPS fetch responses fails with "unexpected end of file" #13058
Comments
This is an upstream bug: rustls/hyper-rustls#162 |
We may need to revert the rustls 0.20 update until we figure this out. The nature of the issue could result in problems outside of WPT. |
This reverts commit a2f1357. Closes denoland#13058.
What I assume is the same issue is also causing Deno to fail to cache deps or run type checks on GitHub Actions CI, which has broken my app's builds. For some reason it doesn't seem to happen on my local MacOS Deno, even though it's the same version.
and
I have re-run the tests several times and they fail similarly each time, though often on a different file. This is Deno 1.17.0 running on GitHub Actions default ubuntu runner. |
Same here |
No fix? not even some monkey-patch? Like what do I do now? Re-write the entire project in another language? 😕 |
Seriously, other than node.js, does anyone have a work-around? |
I think one reason this hasn't gotten "fixed" is that it's arguably a bug on the server side. rustls in 0.20 has become more strict about reporting an error if the peer closes its connection without sending a CloseNotify alert, but as I read RFC 5246 and RFC 8446 they do require sending the alert before closing the (write side of) the connection. So it might be interesting to report servers you're seeing this with and figuring out which TLS stack is running on those servers. |
@djc It fails when Deno connects to another Deno server, so rustls on both client and server. |
The other server it is known to fail on is the web-platform-test server which uses Python’s built in TLS, which uses OpenSSL. |
Well, I feel like there might something specific about Deno because I have not heard from anyone else that's run into similar issues, even though rustls 0.20 has seen significant uptake since it's release 9 months ago. |
@djc That's good info to have. I'll see if I can find anything specific. For client side HTTP, we use I'll see if I can reproduce the failures when making requests to the WPT test server by just using |
It would be good to check if there are similar issues in the reqwest issue tracker. Also good to focus on the error handling edge cases in the integration between Deno and reqwest on the client side and also (perhaps particularly) on the server side. |
Guys, I'm looking for practical solutions that I can implement until this is fixed. For example, I running deno verison 1.22.2 on this project. Does anyone know which version of Deno precedes this bug? Perhaps I can downgrade to a version of deno where this bug goes away, and later upgrade to the latest deno once it is confirmed fix. It is my understanding that the reason Deno is throwing this error, is because the web server I'm requesting from isn't always "sending a CloseNotify alert before closing their response stream". I tire very quickly of frameworks that prioritize correctness over robustness. Something that's not correct is only worthy of a warning if that lack of correctness can be ignored to achieve robustness. |
As a workaround, I'm thinking about just retrying the fetch when the bug occurs. Something like this: For me, the bug rarely happens twice in a row, so maybe I can get past it by just retrying x number of times. Update All I did to my code was add this function at the top, and then I used
The function above was written by Jason Yu. The only modifications I made to it, were (1) I made In summary, I consider this a terrible bug that should rank very high on Deno's ToDo list. Fetch is a fundamental utility that should be rock solid in each deno release. However, I'm glad this bug happened: because it caused me to make my own code way more robust (with or without this bug). |
@Lonniebiz I used this workaround and tried fetching the data 100 times, but the error occurs every single time for me. Are there any other workarounds/fixes available? |
@TimDev9492 Did you find a solution? |
Any solution to this when running |
This doesn't fail with every HTTPS response – https://wpt.live/resources/ works, for example – but it seems to be consistent when it does. It doesn't happen with HTTP at all.
This seems to have been introduced in the upgrade to rustls 0.20 in #12488.
The text was updated successfully, but these errors were encountered: