Briefing

Fix for Truncated Image Responses in Cloudflare Images Binding

hosting
by Matt Lewis · Cloudflare

Apply the hyper patch or upgrade to the latest hyper version to prevent truncated image responses.

What to do now

Apply the hyper patch or upgrade to the latest hyper version.

Summary

Cloudflare’s Images service, built in Rust on Workers, recently experienced intermittent truncation of large image responses after a re‑architecture that moved the binding to use Unix sockets instead of FL. The bug manifested as 200 OK responses with content lengths that promised several megabytes but delivered only a few hundred kilobytes, causing browsers to display partially rendered or broken images.

Investigation revealed a race condition in the hyper HTTP library that caused the Images binding to cut off data when the reader was slightly slower than the writer, even though the outbound buffer was full. The fix required only four lines of code in hyper to correctly flush the internal buffer and avoid premature shutdown, and was applied across all affected deployments.

The issue was isolated by reproducing the nested binding scenario, testing across hyper 0.14, 1.7, and 1.8, and confirming that the truncation persisted until the patch was applied. Cloudflare’s internal binding replaced FL with a local worker binding, eliminating network overhead and improving performance, but also exposing the race condition that led to truncated responses.

The patch restored full image data delivery for large requests and prevented future truncation, ensuring that the Images service reliably returns the expected payload size. Developers using the Images binding should verify that their requests are not affected by the race condition and consider upgrading to the latest hyper version if not already patched.

Key changes

  • Images binding experienced truncated responses for large images after re‑architecture to Unix sockets.
  • 200 OK responses returned content lengths that promised several megabytes but delivered only a few hundred kilobytes.
  • A race condition in hyper caused premature shutdown when the reader was slightly slower than the writer.
  • The fix involved four lines of code in hyper to correctly flush the internal buffer before shutdown.
  • The patch was applied across all affected deployments, restoring full image data delivery.
  • The issue was isolated by reproducing nested binding scenarios and testing hyper 0.14, 1.7, and 1.8.
  • Cloudflare’s internal binding replaced FL with a local worker binding, improving performance but exposing the race condition.
  • Developers should verify requests and consider upgrading to the latest hyper version.

Affects

internal

Customer impact

Analyzing matches…

Ask about this story

Impact on an agency? Which customers? Compare historically Risks of waiting