Skip to content

fix: flush pending socket writes before shutdown - #1054

Open
danlapid wants to merge 1 commit into
cloudflare:mainfrom
danlapid:fix/socket-shutdown-flush
Open

fix: flush pending socket writes before shutdown#1054
danlapid wants to merge 1 commit 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
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.

1 participant