Earlier quoted context omitted.
let _ = …? This is the Rust idiom for “I am intentionally ignoring this return value”. The linter would have caught self.poll_read()?; and in fact one of the options the linter itself suggests in this case is exactly this “let underscore equals” idiom. (Arguably, this code exists because of the linter, not due to its absence!) In any case, the return value is being “handled” - the question mark examines the result an…
>This is the Rust idiom for “I am intentionally ignoring this return value”. That doesn't make the code any less awful, it just makes idiomatic Rust sound awful. Discarding a return value without even a comment to explain why shouldn't be allowed in any critical project, and the linter should be perfectly capable of ensuring that a comment accompanies the discard and complaining loudly when it doesn't.
We found a bug in the hyper HTTP library
71–80 of 97 posts
Re: We found a bug in the hyper HTTP library
#72Would using Rust have prevented this?
In this case a small minority of requests were getting truncated responses.
No one said Rust software is bug free. If someone thinks that they’ve been seriously misled.
Re: We found a bug in the hyper HTTP library
#73> We spent six weeks chasing a nearly invisible bug — a race condition that occurred only under specific conditions — in the hyper library that impacted how the Images binding returned processed image data back to the client. In the end, it took four lines of code to fix it. That's a long time, must be frustrating.
I have had long bug hunts (~a month each) and witnessed ones that took much, much longer. But the longest one I witnessed was drawn out because reproduction was initially unreliable and could take weeks to months. Thankfully, reproduction was by letting a box sit in a corner while tje people involved moved on to other tasks. This kept everybody sane.
Re: We found a bug in the hyper HTTP library
#74> The failure was caused by a timing-dependent race condition in hyper’s HTTP/1 connection handling. When the reader was slower and the socket buffer filled, poll_flush returned Poll::Pending, but the dispatch loop discarded that result. Hyper then treated the response as complete and shut down the socket while data remained buffered internally, causing the client to receive an EOF before the full body arrived. https…
Re: We found a bug in the hyper HTTP library
#75Earlier quoted context omitted.
This does not appear to be a concurrency bug though?
Of course it's a concurrency bug. It races sending data to the kernel against the kernel sending data to the network. If the wrong one wins the bug occurs.
Re: We found a bug in the hyper HTTP library
#76Earlier quoted context omitted.
This does not appear to be a concurrency bug though?
Of course it's a concurrency bug. It races sending data to the kernel against the kernel sending data to the network. If the wrong one wins the bug occurs.
This reads more like an overly broad transition in a deterministic state machine. The fix was to split up a bad transition to shutdown.
Re: We found a bug in the hyper HTTP library
#77Earlier quoted context omitted.
Of course it's a concurrency bug. It races sending data to the kernel against the kernel sending data to the network. If the wrong one wins the bug occurs.
But it did not take 2 threads within the same application to interact in a bad way on data the system controlled to cause this problem. This reads more like an overly broad transition in a deterministic state machine. The fix was to split up a bad transition to shutdown.
Re: We found a bug in the hyper HTTP library
#78Earlier quoted context omitted.
Of course it's a concurrency bug. It races sending data to the kernel against the kernel sending data to the network. If the wrong one wins the bug occurs.
Isn't that like saying there can never be a language with safe concurrency since the code could interact with C code that segfaults? I dunno this kinda reminds me of the 10/10 Rust CVE that turned out to be cmd.exe on Windows not sanitizing inputs and languages like Java just labeled it "won't fix".
Re: We found a bug in the hyper HTTP library
#79Earlier quoted context omitted.
That's not even a bug. That's how TCP works. If you keep sending data to a socket the other side has closed, you get RST.
In case of plain HTTP over TCP, there is even a hint in the spec about why and how a server might want to avoid fully closing prematurely. https://datatracker.ietf.org/doc/html/rfc9112#section-9.6 (this was already in https://datatracker.ietf.org/doc/html/rfc7230#section-6.6 )
Re: We found a bug in the hyper HTTP library
#80Earlier quoted context omitted.
That's not even a bug. That's how TCP works. If you keep sending data to a socket the other side has closed, you get RST.
what is RST?
The relevant condition here is where one side closed its socket but the other side didn't and keeps sending data to the closed socket. That's obviously an improper way to end a connection. A graceful shutdown does not send RST and ensures all data is received on both sides.