Repository navigation
[wrangler] Fix requests hanging after local Worker reloads - #16862
Conversation
🦋 Changeset detectedLatest commit: 1f0ecbb The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
LGTM! |
There was a problem hiding this comment.
✅ Approved — Small, correct fix to how the retry queue is drained, with regression tests for both orderings; no issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
No security concerns.
📖 AGENTS.md: ✅ LGTM
No AGENTS.md updates are needed.
📋 Code Quality: ✅ LGTM
Draining the queue straight after a request is queued again is correct. While the proxy is paused processQueue does nothing, and once play has arrived it retries the request immediately. The regression tests cover both orderings.
⚡ Performance: ✅ LGTM
No performance concerns.
📝 Documentation: ✅ LGTM
The changeset is present, and the updated comment explains why the queue is drained at that point.
Reviewed commit: 1f0ecbbf
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Now that a reload is detected by a new proxyData rather than a changed URL, a root-path GET whose old-preview connection fails after the replacement `play` has already drained the queues is requeued with nothing left to drain it. Before, the URLs matched and the request failed instead. Drain right after requeueing, as Wrangler does since #16862; processQueue still waits while the proxy is paused. Replace the POST reload test with a GET where `play` completes before the old connection drops, and say in the changeset that only GET and HEAD requests are retried.
Fix local requests hanging when their connection to the previous Worker fails after its replacement is already ready.
ProxyWorkernow drains the retry queue immediately after requeueing a stale request. If the proxy is still paused, the request remains buffered untilplayarrives.Previously, the rejection handler assumed a future
playwould drain the queue. Whenplayhad already arrived, the request remained pending until another request triggered queue processing. This addresses the Windows reload timeout observed in #16849. Workerd's additional HTTP retry can expose this ordering, but Wrangler must handle a late rejection regardless of the runtime's timing.Add deterministic regression coverage for the old request failing both before and after the replacement becomes ready. The late-failure case fails without the fix. This queue belongs to Wrangler; Miniflare, the Vite plugin, and the Vitest plugin do not need changes.
Validated locally on macOS:
inflight requests are retried during UserWorker reloadsE2E test passed.check:type, andtype:testspassed.git diff --checkpassed.Windows verification is left to CI.