Skip to content

fix(pg-cloudflare): prevent Client.end() from hanging - #3752

Open
pratik-desgn wants to merge 4 commits into
brianc:masterfrom
pratik-desgn:fix-cloudflare-socket-end-after-close
Open

fix(pg-cloudflare): prevent Client.end() from hanging#3752
pratik-desgn wants to merge 4 commits into
brianc:masterfrom
pratik-desgn:fix-cloudflare-socket-end-after-close

Conversation

@pratik-desgn

@pratik-desgn pratik-desgn commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #3152

Summary

  • complete Cloudflare shutdown when Socket.close() resolves but Socket.closed never settles
  • emit close once, with an identity guard preventing a duplicate event from the normal closed handler
  • add a regression test for a socket that never settles its closed promise

The callback overload used by Connection.end() is already present in the current base branch via #3747.

Validation

  • yarn lint
  • yarn workspace pg-cloudflare build
  • yarn workspace pg-esm-test test --test-name-pattern=pg-cloudflare (12 passed)
  • GitHub CI: lint and all 11 Node/PostgreSQL matrix jobs passed

The PR is limited to pg-cloudflare shutdown behavior and its focused ESM test.

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.

Cloudflare Client.end() hangs if socket did not successfully connect

1 participant