-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Slow requests via std.http.Client
when using TLS
#15029
Comments
std.http.Client
std.http.Client
std.http.Client
when using TLS
What CPU are you testing this on? |
My personal rig, a Ryzen 5900x, as well as whatever specifications the Sourcehut CI has. |
May the lack of I tried a couple websites and this is what those exhibiting the same behavior seem to have in common. |
It's possible, would have to investigate. |
CPU remains very low when it happens, so I suspect an issue in HTTP or TLS framing. |
Could it be related to the TLS bug andrew mentioned in discord a while back? this one in specific. |
Very plausible, yes. |
Downloading with $> zig build
error: BadReaderState I have been doing some tests with pkg-manager (MVP) and GH actions can download the packages listed in the zon, more than on my own home network. |
I've now done a bit more poking around at the actual cause of this issue. It seems like the tls client is trying to eagerly read data from the stream, even though it may be able to give the user data. This causes the last part of the message to never be received until the peer closes the connection (which would explain the consistent 2 minute pause for everyone). |
Interesting. Definitely sounds like it is somewhat related to the TLS bug andrew mentioned. |
Zig Version
0.11.0-dev.2160+49d37e2d1
Steps to Reproduce and Observed Behavior
When attempting to make a GET request to any web page using TLS, the request seems to take 5x longer to read, this can be observed by running
zig run -lc example.zig
, whereexample.zig
contains the minimal reproduction code below:However, it is noticed that when doing the same with a site not using TLS, it does not appear to happen. This also appears to affect the package manager that was implemented in #14265. This can once again be reproduced by using the following minimal reproduction:
I have eliminated any chances of this being an antivirus or firewall issue, as my system uses Windows' built-in stuff, and I have made no changes to any settings. Around a week ago, however, I noticed this slowdown suddenly start happening, not only on my own devices, but on CI's from multiple websites such as sr.ht, and codeberg.
Expected Behavior
According to
hyperfine
, downloading the tarball in the reproduction code above takes normally ~300-500msAfter compiling the reproduction code to eliminate the chances of it being build-time related, we can see it being nearly 350x slower.
The text was updated successfully, but these errors were encountered: