We found a bug in the hyper HTTP library
- Programming
- Infrastructure
- Open Source
- Developer Tools
Cloudflare’s post walks through a six-week hunt for a bug in hyper, the widely used Rust HTTP library. Under a narrow set of HTTP/1 conditions, hyper could decide a response was finished before all buffered bytes had actually been flushed to the socket. If the client was slow enough to fill the kernel send buffer, `poll_flush` returned `Poll::Pending`, that result got discarded, and hyper shut down the connection early. The visible symptom was rare truncated responses. The eventual fix was tiny. The path to finding it was not.
If you run async Rust in production, tighten your lint policy around ignored `must_use` values and `let _ =` immediately. More broadly, treat graceful shutdown and backpressure paths as failure-prone code, because that is where “safe” stacks still lose data.
- blog.cloudflare.com
- Discuss on HN