Skip to content

[miniflare] Fix requests failing after 5 minutes due to undici Pool default timeouts#13015

Merged
petebacondarwin merged 1 commit into
mainfrom
miniflare-disable-pool-timeouts
Mar 23, 2026
Merged

[miniflare] Fix requests failing after 5 minutes due to undici Pool default timeouts#13015
petebacondarwin merged 1 commit into
mainfrom
miniflare-disable-pool-timeouts

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin commented Mar 23, 2026

Fixes #12949.

Miniflare's two undici Pool instances (the main runtime dispatcher in index.ts and the sync proxy dispatcher in fetch-sync.ts) were created without any timeout configuration, causing them to silently inherit undici's default headersTimeout and bodyTimeout of 300,000 ms (5 minutes).

Any request taking longer than 5 minutes — streaming responses, large uploads, long-polling, or compute-heavy Workers — would be killed by undici with a "request failed" error.

Setting both timeouts to 0 disables them entirely. This is the correct behaviour for a local development tool, and is consistent with the existing pattern in dev-registry.worker.ts where Node.js HTTP server timeouts are explicitly disabled for the same reason (long-lived WebSocket connections).


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: this changes timeout defaults that are not exercised by the existing test suite (no test runs for >5 minutes), and the fix is a straightforward configuration change consistent with existing patterns in the codebase.
  • Public documentation
    • Documentation not necessary because: internal implementation detail, no user-facing API change.

Open with Devin

…r local dev

Miniflare's undici Pool instances were inheriting the default 300s
(5 minute) headersTimeout and bodyTimeout. Requests taking longer than
that — streaming responses, large uploads, long-polling, or
compute-heavy Workers — would be killed with a 'request failed' error.

Setting both to 0 disables them entirely, consistent with the existing
pattern in dev-registry.worker.ts where Node.js HTTP server timeouts
are also disabled for the same reason.

Fixes #12949
@petebacondarwin petebacondarwin requested a review from a team as a code owner March 23, 2026 12:31
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 23, 2026

🦋 Changeset detected

Latest commit: cdd8e51

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 23, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions
Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Mar 23, 2026

The change is straightforward, correct, and complete:

  • Both Pool instantiations in miniflare are updated.
  • headersTimeout: 0 and bodyTimeout: 0 are the documented way to disable undici's default 5-minute timeouts.
  • The changeset is properly formatted as a patch for miniflare.
  • The fix is appropriate for a local dev tool where artificial timeouts are undesirable.

LGTM

github run

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 23, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13015

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13015

miniflare

npm i https://pkg.pr.new/miniflare@13015

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13015

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13015

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13015

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13015

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13015

wrangler

npm i https://pkg.pr.new/wrangler@13015

commit: cdd8e51

Comment thread packages/miniflare/src/index.ts
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Mar 23, 2026
@petebacondarwin petebacondarwin merged commit 6a6449e into main Mar 23, 2026
52 of 56 checks passed
@petebacondarwin petebacondarwin deleted the miniflare-disable-pool-timeouts branch March 23, 2026 16:25
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Mar 23, 2026
@petebacondarwin petebacondarwin added the ci-flake Applied to PRs addressing CI flakiness label Apr 9, 2026
@workers-devprod
Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-flake Applied to PRs addressing CI flakiness

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Requests are failing after some time

3 participants