Skip to content

fix: flush pending socket writes before shutdown - #1054

Merged
guybedford merged 2 commits into
cloudflare:mainfrom
danlapid:fix/socket-shutdown-flush
Sep 12, 2026
Merged

fix: flush pending socket writes before shutdown#1054
guybedford merged 2 commits into
cloudflare:mainfrom
danlapid:fix/socket-shutdown-flush

Conversation

@danlapid

@danlapid danlapid commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

A pending write retains the WritableStream writer lock. Calling close on the stream at that point rejects instead of completing the write and closing the writable side.

Poll the outstanding write before starting close, returning Pending or the write error as appropriate. Tests use a controlled write promise to cover completion and failure; both fail without this change and pass with it under Node 26.

A pending write retains the WritableStream writer lock. Calling close on
the stream at that point rejects instead of completing the write and
closing the writable side.

Poll the outstanding write before starting close, returning Pending or
the write error as appropriate. Tests use a controlled write promise to
cover completion and failure; both fail without this change and pass
with it under Node 26.
@danlapid
danlapid requested a review from guybedford as a code owner September 6, 2026 14:37
@guybedford
guybedford enabled auto-merge (squash) September 12, 2026 00:44
@guybedford
guybedford merged commit f5e5581 into cloudflare:main Sep 12, 2026
16 of 17 checks passed
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.

2 participants