How we found a bug in the hyper HTTP library
Jun 22, 2026Deanna Lam, Diretnan Domnan, Matt Lewis

Summary
This post details the discovery and resolution of a race condition bug in the hyper HTTP library used by the Cloudflare Images service. The bug caused intermittent truncation of image responses, particularly for larger images, when communicating between the Workers runtime and the Images service via Unix sockets. The issue was traced to hyper's buffer management when writing response data to the socket, specifically when the receiving end was slower than the sender. A four-line code change in hyper, addressing how shutdown signals were handled in relation to buffer flushing, resolved the issue.