Cloudflare does not notice (until a customer complains) that they are sending broken responses at scale? I would have thought they would notice this from sampling and linting a few replies.. just in case they did something like Cloudbleed again.
ramon156 · 2026-06-29 10:38:07 UTC
Can you get reasonable results without exposing sensitive info? I'm asking because I genuinely have no idea what it's like at their scale
100ms · 2026-06-29 09:08:53 UTC
> 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.
This is relevant if the client sends multiple requests but the server decides to close the connection after one of them. The server should discard the additional requests until the client signals no more requests are coming.
connection reset - TCP says "this connection is too messed up, abort, abort!"
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.
moralestapia · 2026-06-29 16:31:20 UTC
Hey, you have to justify three engineers full time's worth of salary.
algoth1 · 2026-06-29 10:26:40 UTC
I wonder if this bug was found via project glasswing
re-thc · 2026-06-29 11:40:54 UTC
> I wonder if this bug was found via project glasswing
Did you read how they said it took weeks? Would run out of tokens at that rate...
worldsavior · 2026-06-29 10:50:25 UTC
> 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.
gmueckl · 2026-06-29 16:28:45 UTC
It is a long time and it gets frustrating when there is significant time where there is flailing with no visible progress.
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.
Atotalnoob · 2026-06-30 02:35:48 UTC
Sometimes the best option is to enhance observability and see when it happens again
microgpt · 2026-06-29 11:11:28 UTC
Would using Rust have prevented this?
Cthulhu_ · 2026-06-29 11:37:54 UTC
The Hyper library in question is a Rust library.
Did you read the article, or are you a "use rust" parrot / bot based on titles?
waysa · 2026-06-29 11:52:47 UTC
Sarcasm. (I guess)
frankharv · 2026-06-29 12:37:14 UTC
Obviously written by a C freak using a BSD
re-thc · 2026-06-29 11:38:53 UTC
Isn't this already Rust?
pjmlp · 2026-06-29 11:52:31 UTC
That was obviously a joke question, pointing that Rust isn't the solution for everything.
lelanthran · 2026-06-29 12:28:16 UTC
Woosh :-)
geodel · 2026-06-29 13:30:42 UTC
Agree. This is warning to people who thought Rust is optional at cloud scale.
Ygg2 · 2026-06-29 13:53:33 UTC
No. Anyone expecting that hasn't read No Silver Bullet essay.
tialaramex · 2026-06-29 14:12:06 UTC
Actually I suspect that Rust is a Silver Bullet in that sense. That essay seems to be a case where people know of the essay but haven't read it. Normally in English a "Silver Bullet" is something much bigger, a panacea or cure all which entirely solves a problem but in his essay Brooks is talking about order-of-magnitude improvements, and that looks a lot like Rust.
Brooks was expecting such "Silver Bullet" improvements as often as every few decades, we're arguably overdue significantly. He cites Ada as an example of where such an improvement might come from, well, Rust isn't Ada but a lot of the same ideas about correctness are present.
Google reports order of magnitude changes from their Rust work for example.
HumanOstrich · 2026-06-29 14:18:35 UTC
Order of magnitude more complexity.
Ygg2 · 2026-06-29 21:40:40 UTC
> Actually I suspect that Rust is a Silver Bullet in that sense.
Not really. If anything I'm pretty sure Fred would compare it to Ada:
> Nevertheless, Ada will not prove to be the silver bullet that slays the software productivity monster, It is, after all, just another high-level language, and the biggest payoff from such languages came from the first transition, up from the accidental complexities of the machine into the more abstract statement of step-by-step solutions.
And I think he'd be on the money. Rust and Ada are revolutionary languages in their own right, but 10x holy grail they aren't.
tialaramex · 2026-06-30 00:43:10 UTC
> And I think he'd be on the money. Rust and Ada are revolutionary languages in their own right, but 10x holy grail they aren't.
Google reports 4x fewer (and still falling) rollbacks for Rust versus C++ in their Android development for example. That's not 10x but it's pretty sizeable.
pjmlp · 2026-06-30 10:07:51 UTC
Which they could equally achieve by reducing even further the use of NDK, or moving more stuff into Kotlin/Java processes using Android IPC.
Naturally there are several ideological questions between that approach from the anti GC crowd, and adopting Rust instead.
Not that breaks the C++ vs Rust from your comment, though.
tancop · 2026-06-30 11:28:28 UTC
thats how you get bloated memory use and disk space. you know, the things everyone complains about when it comes to modern tech
pjmlp · 2026-06-30 11:45:24 UTC
Only by programmers that missed algorithms and data structures classes, unfortunately plenty of them nowadays, fresh out of JavaScript and Python Web bootcamps with zero CS background.
Folks that wonder pre-history tech with amazement and lack of understanding of how it used to work in first place.
The problem in your classic DS&A class is that they spend scant attention if any on the crucial difference between "This big-O evaluation is awesome" and "In the real world this goes fast/ is small"
The Red Black tree, C++ std::map is a classic example. It has these very attractive theoretical properties, but then you try one for real in C++ and oh, why is this so slow and so RAM hungry? Well yeah, those are only real world problems, the big-O numbers don't care about that.
pjmlp · 2026-06-30 16:01:28 UTC
C++ implementation problems are another matter, caused by how WG21 sadly works, than anything else.
Ironically there are C# implementations that perform better, exactly because they were developed without WG21 working environment, in a compiled managed language.
For all the performance minded talk, the walk doesn't always follow.
Also std::map cannot be improved by existing processes.
testdelacc1 · 2026-06-29 15:52:51 UTC
I get that it’s fun to dunk on Rust when a Rust bug surfaces. But is it a bit petty to bring this out when there’s any type of bug of any severity in any Rust software?
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.
Thaxll · 2026-06-29 11:37:59 UTC
So much for Rust forcing you to handle errors.
atoav · 2026-06-29 11:45:15 UTC
You could say the exact same thing about safety belts and airbags in cars after someone has died in a crash.
Why even bother with measures that prevent many problems if they won't prevent all of them, right?
chlorion · 2026-06-29 13:18:39 UTC
This is the argument I like too.
It's the same argument anti-vaxers love to make. "Well you can still get covid after getting the shot", which is something I read and heard quite a lot. That doesn't make the thing useless.
Humans are really dumb.
atoav · 2026-06-29 18:34:15 UTC
The older I get the more I realise that I have taken way to much of my mathematical intuition for granted.
This I'd an example of people not grasping simple probabilities. Forced to play Russian Roulette they prefer the revolver with 5 bullets in its chambers or the one with just a single bullet, because in both cases people die.
Other concepts many people do not grasp are feedback-loops and exponentials. And by not grasp I mean: You explain it to them, the nod along and when faced with the thing in slightly different clothes they will actively deny it'd existence.
wongarsu · 2026-06-29 11:49:04 UTC
You could argue the bug happened exactly because hyper's poll_flush treats flushing some but not all data as a successful return, not an error case.
Matl · 2026-06-29 13:18:51 UTC
Go does force you too, but it also supports _ as a bypass - because sometimes you do know better. Just not in this case.
Rust never promised it'll let programmers turn off their brain, that's what LLMs are for.
jerf · 2026-06-29 13:51:20 UTC
There's a hidden equivocation there. "Handling" errors, as far as the language is concerned, mean you do something with them, but explicitly discarding them is most definitely a "something".
From a human perspective we can consider that not handling the error.
But the language has no mechanism for "knowing" that discarding the error is wrong. Discarding errors is a fully valid mechanism that we must be able to do in a program because it is sometimes correct. There really isn't even a sensible way to define a way to "force" a user to "handle" errors. The language can only be designed to make it hard to forget to "handle" them somehow in the way the language sees, but it is always possible for the user to incorrectly handle them, of which discarding them when they shouldn't have is only one particularly cognitively-available option but is hardly the full scope of possibilities. Probably isn't even the most common mistake to make, I would imagine there are far more errors that are not handled "correctly" than ones that are spuriously discarded.
Note I keep saying "language" rather than Rust. All a language can do is surface the issue, and Rust does that. It can't force good code. No language can.
Twey · 2026-06-29 11:39:32 UTC
This would have been flagged by Clippy lints `let_underscore_untyped` or `let_underscore_must_use`, which sadly are not enabled by default.
pwdisswordfishq · 2026-06-29 12:09:22 UTC
Ehh, easy fix
#[allow(clippy::let_underscore_untyped,clippy::let_underscore_must_use)]
let _ = self.poll_flush(cx)?;
nesarkvechnep · 2026-06-29 12:17:09 UTC
Yeah, but you must know about them and the possible bug first in order to allow them...
Joker_vD · 2026-06-29 12:25:07 UTC
At which point you wouldn't have written this bug in the first place; or the warnings would trigger immediately, you'd change _ to an actual variable and then remove the warning pragmas because now you don't assign to _.
Twey · 2026-06-29 12:40:47 UTC
`Poll` is marked `#[must_use]` so if you were assigning to something other than `_` you'd get a warning that you're ignoring the `Pending` path. The Clippy lint is only for `_` which Rust considers a use by default.
Twey · 2026-06-29 12:39:02 UTC
Hence ‘sadly’. IMNSHO both of these (or at least _untyped) should be enabled by default. Untyped `let _` is too big a footgun during refactorings.
turboponyy · 2026-06-29 14:22:22 UTC
Not really. If I'm using a linter, I go and configure the strictest possible ruleset, and only disable rules when justified on a need-by-need basis. It's just a matter of discipline.
lunar_mycroft · 2026-06-29 12:20:39 UTC
You can set the lints to `forbid` instead of `deny`, which means they can't be `allowed` like that.
Twey · 2026-06-29 12:36:57 UTC
I said ‘flagged’, not ‘fixed’ :)
You can always write the wrong code if you want it enough. But hopefully a warning would have prompted someone to think harder about this flow.
pwdisswordfishq · 2026-06-29 13:02:11 UTC
But "let _ =" is already an explicit suppression of a must-use warning. Where does this arms race of "no, I really know what I am doing, compiler" versus "no, this really looks like a mistake, programmer" end?
Twey · 2026-06-29 13:28:21 UTC
That's an excellent question I don't have an answer for in general :)
IMHO the goal is usually for the compiler not to make these decisions but to provide the tools for the APIs people build to make them. That's kind of passing the buck, though.
I guess in this case the core problem is that the API for these I/O calls has no representation in the type system for what's happening to the buffer. Proxying it as ‘the programmer must think about this code path’ is a reasonable best-effort but, evidently, sometimes inadequate.
tialaramex · 2026-06-29 14:00:25 UTC
I do feel like Rust did enough to allow software engineers and their managers to make an explicit choice here.
Twey · 2026-06-30 12:24:08 UTC
I think it definitely sits at a reasonable point in the tradeoff space here, but it's not the only reasonable point. And it's the nature of tradeoffs that some cases will slip through the cracks.
PoignardAzur · 2026-06-29 14:01:10 UTC
And this is why you should warn on `clippy::allow_attributes_without_reason` in your projects.
pwdisswordfishq · 2026-06-30 16:07:15 UTC
#[allow(clippy::allow_attributes_without_reason,clippy::let_underscore_untyped,clippy::let_underscore_must_use)]
let _ = self.poll_flush(cx)?;
microgpt · 2026-06-29 13:10:53 UTC
Or just by not writing let _ =
Twey · 2026-06-29 13:31:11 UTC
All recurrent people problems are system problems.
microgpt · 2026-06-29 14:32:41 UTC
As seen by the fact that forcing the programmer to write let _ = to silence the warning did not fix the bug.
You know what might've solved this though? Using threads instead of async
Twey · 2026-06-30 00:07:44 UTC
I think that's more of a workaround than a fix. Relying on unstructured concurrency does mean you no longer have to understand the scheduling of your program's fibres (… until you do), but it introduces a bunch of new footguns around things like correct cancellation, error propagation, and predicting resource lifetimes.
pseudony · 2026-06-29 12:00:00 UTC
So “fearless concurrency” still only happens when one just decides to not be afraid… :)
c0balt · 2026-06-29 12:06:48 UTC
This does not appear to be a concurrency bug though?
pseudony · 2026-06-29 12:49:37 UTC
“ a race condition that occurred only under specific conditions — in the hyper library”
conradludgate · 2026-06-30 05:04:58 UTC
Fearless concurrency has always been regarding data races. There's no fear of undefined behaviour due to a race condition.
Rust has never promised to solve race conditions as a whole.
microgpt · 2026-06-29 13:12:39 UTC
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.
inexcf · 2026-06-29 16:47:49 UTC
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".
microgpt · 2026-06-29 17:37:56 UTC
You mean the one where Windows doesn't have argv the way Unix does, and instead just has a single string that is interpreted slightly differently by each executable? That is a language making false assertions about how the underlying platform works, causing an impedance mismatch that is impossible to fix.
inexcf · 2026-06-29 18:17:53 UTC
Yeah, the one most languages (except for Rust)* decided was not a language problem and did not fix.
*should clarify, Node.js, PHP, and Haskell did ship patches. Python, Ruby, Erlang, and Go opted for documentation updates; Java went "won't fix."
tetha · 2026-06-29 17:06:54 UTC
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.
microgpt · 2026-06-29 17:36:14 UTC
Concurrency bugs don't have to be within a single process.
inexcf · 2026-06-29 18:49:33 UTC
By that definition, every write() call that doesn't check for EAGAIN is a concurrency bug you're racing the disk controller. The term stops meaning anything.
nopurpose · 2026-06-29 12:14:14 UTC
Nice writeup, but I don't understand how `curl` didn't trigger bug for them (or any other hyper HTTP server out there), given the explanation in the article.
`curl --http1.1` sends `Connection: Close` so sender (hyper) must attempt to shutdown connection after sending whole body. Surely any network is slower than memory copy into socket kernel buffers, so it must reliably trigger condition "buffer flush can't be done in one go" and thus trigger early TCP shutdown.
xacky · 2026-06-29 14:24:44 UTC
Yet Cloudflare relies on bugs in browsers to "verify" you.
Comments
https://github.com/hyperium/hyper/issues/4022
Saved you 3000 words
https://datatracker.ietf.org/doc/html/rfc9112#section-9.6 (this was already in https://datatracker.ietf.org/doc/html/rfc7230#section-6.6)
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.
Did you read how they said it took weeks? Would run out of tokens at that rate...
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.
Did you read the article, or are you a "use rust" parrot / bot based on titles?
Brooks was expecting such "Silver Bullet" improvements as often as every few decades, we're arguably overdue significantly. He cites Ada as an example of where such an improvement might come from, well, Rust isn't Ada but a lot of the same ideas about correctness are present.
Google reports order of magnitude changes from their Rust work for example.
Not really. If anything I'm pretty sure Fred would compare it to Ada:
And I think he'd be on the money. Rust and Ada are revolutionary languages in their own right, but 10x holy grail they aren't.Google reports 4x fewer (and still falling) rollbacks for Rust versus C++ in their Android development for example. That's not 10x but it's pretty sizeable.
Naturally there are several ideological questions between that approach from the anti GC crowd, and adopting Rust instead.
Not that breaks the C++ vs Rust from your comment, though.
Folks that wonder pre-history tech with amazement and lack of understanding of how it used to work in first place.
https://news.ycombinator.com/item?id=48727323
The Red Black tree, C++ std::map is a classic example. It has these very attractive theoretical properties, but then you try one for real in C++ and oh, why is this so slow and so RAM hungry? Well yeah, those are only real world problems, the big-O numbers don't care about that.
Ironically there are C# implementations that perform better, exactly because they were developed without WG21 working environment, in a compiled managed language.
For all the performance minded talk, the walk doesn't always follow.
Also std::map cannot be improved by existing processes.
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.
Why even bother with measures that prevent many problems if they won't prevent all of them, right?
It's the same argument anti-vaxers love to make. "Well you can still get covid after getting the shot", which is something I read and heard quite a lot. That doesn't make the thing useless.
Humans are really dumb.
This I'd an example of people not grasping simple probabilities. Forced to play Russian Roulette they prefer the revolver with 5 bullets in its chambers or the one with just a single bullet, because in both cases people die.
Other concepts many people do not grasp are feedback-loops and exponentials. And by not grasp I mean: You explain it to them, the nod along and when faced with the thing in slightly different clothes they will actively deny it'd existence.
Rust never promised it'll let programmers turn off their brain, that's what LLMs are for.
From a human perspective we can consider that not handling the error.
But the language has no mechanism for "knowing" that discarding the error is wrong. Discarding errors is a fully valid mechanism that we must be able to do in a program because it is sometimes correct. There really isn't even a sensible way to define a way to "force" a user to "handle" errors. The language can only be designed to make it hard to forget to "handle" them somehow in the way the language sees, but it is always possible for the user to incorrectly handle them, of which discarding them when they shouldn't have is only one particularly cognitively-available option but is hardly the full scope of possibilities. Probably isn't even the most common mistake to make, I would imagine there are far more errors that are not handled "correctly" than ones that are spuriously discarded.
Note I keep saying "language" rather than Rust. All a language can do is surface the issue, and Rust does that. It can't force good code. No language can.
You can always write the wrong code if you want it enough. But hopefully a warning would have prompted someone to think harder about this flow.
IMHO the goal is usually for the compiler not to make these decisions but to provide the tools for the APIs people build to make them. That's kind of passing the buck, though.
I guess in this case the core problem is that the API for these I/O calls has no representation in the type system for what's happening to the buffer. Proxying it as ‘the programmer must think about this code path’ is a reasonable best-effort but, evidently, sometimes inadequate.
You know what might've solved this though? Using threads instead of async
Rust has never promised to solve race conditions as a whole.
*should clarify, Node.js, PHP, and Haskell did ship patches. Python, Ruby, Erlang, and Go opted for documentation updates; Java went "won't fix."
This reads more like an overly broad transition in a deterministic state machine. The fix was to split up a bad transition to shutdown.
`curl --http1.1` sends `Connection: Close` so sender (hyper) must attempt to shutdown connection after sending whole body. Surely any network is slower than memory copy into socket kernel buffers, so it must reliably trigger condition "buffer flush can't be done in one go" and thus trigger early TCP shutdown.