-
-
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
intermittent TlsConnectionTruncated #14573
Comments
On 0.12.0-dev.5+fc6e57568 (macOS x64_64) I see a out-of-bounds panic instead of an error:
The panic is consistent for me, but the number of "info: got XXX bytes" logs that happens before the panic varies wildly between runs. I'm seeing everything between zero and 45 read chunks before the failure. With double the read buffer size |
I'm also experiencing the issue @hryx mentioned on macOS ARM M2 zig/lib/std/crypto/tls/Client.zig Lines 1066 to 1072 in d2014fe
zig/lib/std/crypto/tls/Client.zig Lines 1245 to 1251 in d2014fe
And it's set here zig/lib/std/crypto/tls/Client.zig Lines 1001 to 1010 in d2014fe
|
I just tried this on 0.13.0, set the buffer size to 300 and I got a panic:
The TLS implementation is pretty riddled with bugs atm, I noticed multiple when I was working on fixing this. |
In this case, buffer size 300, example from the first post in this thread, in line:
read is called with zero size buffer. |
Zig Version
0.11.0-dev.1507+6f13a725a
Steps to Reproduce and Observed Behavior
I found this intermittent issue when trying to use the new std TLS implementation for zigup. I've created a small application that will intermittently reproduce the issue. It's extremely intermittent. Once I had 30 successful runs before I saw it, but usually I see it before 10 runs, sometimes after the first few runs as well. Seems to happen on CI pretty often though (see https://github.com/marler8997/zigup/actions/runs/4095377532/jobs/7066880134), it's odd. It also seems to be sensitive to the "read buffer size".
Here's the program:
This program sends a simple HTTP request to download the zig 0.7.0 linux tarball release. A non-successful run (can take running a bunch of times to see) looks like this:
If I change the buffer size to
8192 * 10
, then I get a different error:Another thing to note is that in a wireshark trace, nothing coming from the server seems "out of the ordinary" as far as I can see. The server isn't trying to close the connection, it seems to just be sending the data and then suddenly the client closes the connection with "RST" packets.
Expected Behavior
The commands above to build and then run
tlsbug.zig
should end with output that looks like this:The program shouldn't intermittently fail.
The text was updated successfully, but these errors were encountered: