Skip to content

fix(http): /api/raw no longer hangs when a file shrinks mid-transfer - #22

Merged
jkyberneees merged 4 commits into
mainfrom
fix/raw-stream-abort
Nov 3, 2026
Merged

jkyberneees merged 4 commits into
mainfrom
fix/raw-stream-abort

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

The v1.10.7 release stopped at its test step: the /api/raw shrinking-file test timed out, on a commit where ci had passed. Nothing was published.

Cause. This is a real hang, and it predates #21: v1.10.6 failed the same test 4 runs in 30. Bun 1.4.4 can lose a stream error raised right after a chunk, so the connection stays open with no end of body. idleTimeout: 0 never reclaims it, and a client's blob() waits forever.

Fix. Wait 50 ms inside pull before the error. The delay is measured, not derived, because the cause is inside Bun.

Variant Result
Immediate error, about 1 in 4 runs hang still hangs
Error after pull returns, throw, generator, direct stream, server.timeout, padding chunks still hang
50 ms inside pull no hang: readers up to 400 ms per chunk, and under CPU load

Test. Now 25 rounds with a watchdog. It reports hang without the fix, and had no failures in 500 rounds with it. The full suite passed twice locally.

DESIGN.md §25 has the details.

🤖 Generated with Claude Code

jkyberneees and others added 2 commits November 3, 2026 18:58
Bun 1.4.4 can lose a stream error raised right after a chunk, leaving the connection open with no
end of body. The server now waits 50 ms inside pull before the error. The test ran this race once,
so it failed at random and stopped the v1.10.7 release; it now runs 25 rounds and reports a hang.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
2810182 2026-11-03T18:19:15.591Z View logs ↗
  • Build: Failed ❌

View logs ↗
6a23a41 2026-11-03T18:05:43.559Z View logs ↗

@jkyberneees
jkyberneees merged commit ab6d395 into main Nov 3, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant