Skip to content

[miniflare] Keep Hyperdrive client socket errors from crashing local dev - #15799

Closed
RealBhupesh wants to merge 2 commits into
cloudflare:mainfrom
RealBhupesh:fix/hyperdrive-client-socket-error
Closed

RealBhupesh wants to merge 2 commits into
cloudflare:mainfrom
RealBhupesh:fix/hyperdrive-client-socket-error

Conversation

@RealBhupesh

@RealBhupesh RealBhupesh commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15768.

The local Hyperdrive proxy piped the workerd client socket to the database socket and only listened for errors on the database side. pipe() does not keep a listener on the source, so a client reset became an unhandled error event and exited the Node process. That took down wrangler dev and test runs.

Client and database sockets now destroy each other when either side errors, including the plain TCP path and the TLS handshake path.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this is internal local-proxy error handling; there is no user-facing API or config change.

Made with Cursor


Devin Review

The proxy listened for errors on the database socket only. A reset from
the workerd client had no listener, so Node exited the dev process.

Fixes cloudflare#15768
@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b4696a5

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

This PR includes changesets to release 8 packages
Name Type
miniflare Patch
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
wrangler Patch

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Sep 23, 2026
@workers-devprod
workers-devprod requested review from a team and tpmmorris and removed request for a team September 23, 2026 08:17
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/hyperdrive-client-socket-error.md: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/hyperdrive/hyperdrive-proxy.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/hyperdrive/proxy.spec.ts: [@cloudflare/wrangler]

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@15799

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@15799

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15799

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@15799

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@15799

create-cloudflare

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

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@15799

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@15799

@cloudflare/pages-shared

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

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@15799

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15799

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@15799

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: b4696a5

…nt resets early

The client error guard was attached only after the fallback TCP connection
resolved. A reset during that connect left the new database socket open.
@cjol
cjol requested review from cjol and removed request for tpmmorris September 28, 2026 11:28
@cjol

cjol commented Sep 28, 2026

Copy link
Copy Markdown
Member

Closing in favour of #15769

@cjol cjol closed this Sep 28, 2026
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.

[miniflare] Hyperdrive proxy crashes the Node process when the client socket errors

3 participants