Skip to content

Conversation

@Ltadrian
Copy link
Contributor

@Ltadrian Ltadrian commented Nov 27, 2025

Fix Hyperdrive binding slow latency on Windows for npx wrangler dev command

  • Update localhost to 127.0.0.1 address to fix issue with Windows defaulting to ipv6 lookup and timing out
  • Fix skipped Windows Hyperdrive tests which were failing due to miniflare dispose() causing connection reset errors. It was causing the child process to crash but this is now fixed with calling node spawn and cleanly handling those specific connection errors by error code

Fixes #SQC-707

Customer reached out on discord reporting slow latency of 2000ms when using Hyperdrive binding and localConnectionString pointing at local db. Was able to reproduce on Windows 10 PC and get latency back to 8ms-15ms


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Bug fix
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: miniflare change

@changeset-bot
Copy link

changeset-bot bot commented Nov 27, 2025

🦋 Changeset detected

Latest commit: 529988a

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

@Ltadrian Ltadrian changed the title SQC-707 Fix npx wrangler dev with Hyperdrive binding slow latency on SQC-707 Fix Hyperdrive binding slow latency on Windows Nov 27, 2025
@Ltadrian Ltadrian force-pushed the agracia/SQC-707-fix-windows-hyperdrive branch from dffbd2f to 6f432c0 Compare December 1, 2025 16:59
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Dec 1, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 1, 2025

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11443

wrangler

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

commit: 529988a

@Ltadrian Ltadrian force-pushed the agracia/SQC-707-fix-windows-hyperdrive branch 4 times, most recently from e24787b to d1f336d Compare December 1, 2025 19:47
@Ltadrian Ltadrian marked this pull request as ready for review December 1, 2025 20:48
@Ltadrian Ltadrian requested a review from a team as a code owner December 1, 2025 20:48
@jamesopstad
Copy link
Contributor

  • Update localhost to 127.0.0.1 address to fix issue with Windows defaulting to ipv6 lookup and timing out

It looks like this is the only implementation change in the PR. Just so I understand, can you explain how this improves the latency? If it was previously timing out wouldn't that be an error rather than slow?

@Ltadrian
Copy link
Contributor Author

Ltadrian commented Dec 3, 2025

  • Update localhost to 127.0.0.1 address to fix issue with Windows defaulting to ipv6 lookup and timing out

It looks like this is the only implementation change in the PR. Just so I understand, can you explain how this improves the latency? If it was previously timing out wouldn't that be an error rather than slow?

Never actually saw a timeout error when running npx wrangler dev. I think Windows would timeout during DNS localhost lookup expecting a response from IPV6 and fallback to IPV4 which would then actually succeed. The end result was slower latency instead of a timeout error from the worker during the connect() step

@jamesopstad
Copy link
Contributor

  • Update localhost to 127.0.0.1 address to fix issue with Windows defaulting to ipv6 lookup and timing out

It looks like this is the only implementation change in the PR. Just so I understand, can you explain how this improves the latency? If it was previously timing out wouldn't that be an error rather than slow?

Never actually saw a timeout error when running npx wrangler dev. I think Windows would timeout during DNS localhost lookup expecting a response from IPV6 and fallback to IPV4 which would then actually succeed. The end result was slower latency instead of a timeout error from the worker during the connect() step

I see. Thanks, that makes sense.

Copy link
Contributor

@jamesopstad jamesopstad left a comment

Choose a reason for hiding this comment

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

Thanks. I've merged a PR to increase the test timeout so please bring this up to date with main before rerunning the tests.

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Dec 3, 2025
Windows
- Update localhost to 127.0.0.1 address to fix issue with Windows
  defaulting to ipv6 lookup and timing out
- Fix skipped Windows Hyperdrive tests which were failing due to dispose
  causing connection reset errors. It was causing the child process to
  crash but this is now fixed with calling node spawn and cleanly
  handling windows connections errors
@Ltadrian Ltadrian force-pushed the agracia/SQC-707-fix-windows-hyperdrive branch from 2825cce to 529988a Compare December 4, 2025 01:16
@jamesopstad jamesopstad merged commit 56e78c8 into cloudflare:main Dec 4, 2025
31 of 32 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Dec 4, 2025
@lrapoport-cf lrapoport-cf mentioned this pull request Dec 4, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants