We found a bug in the hyper HTTP library
8 days ago
- #hyper
- #Cloudflare
- #bug-fix
- The Images service, built in Rust on Workers, runs on every machine in Cloudflare's edge network and uses the hyper HTTP library.
- In 2025, the Images binding was rearchitected for a more direct connection, but later intermittent failures occurred for larger images with truncated responses.
- The bug was a race condition in hyper where a slow reader could cause a premature socket shutdown, losing data; it was fixed with a four-line code change.
- Investigation involved distributed tracing, strace syscall analysis, and a custom test to reproduce the bug, leading to a targeted fix in hyper's poll_shutdown.
- The fix was contributed upstream to hyper, stabilizing the binding and enabling expanded functionality, including support for hosted images.