Cloudflare's Images team discovered a race condition bug in the open-source hyper HTTP library (affecting versions 0.14 through 1.8) while rearchitecting the Images binding to use Unix sockets instead of FL. The bug caused intermittent response truncation for large images: hyper's dispatch loop discarded the `Poll::Pending` return value from `poll_flush`, allowing the connection to shut down before all buffered data was written to the socket. The issue only surfaced in production with real concurrency and a reader that occasionally paused, never appearing with curl or local tests. The team used `strace` to observe actual syscalls and confirm the premature `SHUT_WR` call. The fix — four lines added to `poll_shutdown` to flush remaining data before closing — was contributed upstream as PR #4018 to hyperium/hyper.
Table of contents
Hops, handoffs, and hyperTaking the local200 OK (not OK)Debugging in the darkA kernel of truthInside the dispatch loopDon’t forget to flushWhat stayed with us82.7K Impressions2 Comments