Repository navigation
Conversation
`Connection._send()` calls `stream.write(buffer)` with no callback, so `CloudflareSocket.write()` fell back to its no-op default callback and a rejected `WritableStreamDefaultWriter.write()` was discarded. The query then hung until the socket closed and the real failure surfaced only as "Connection terminated unexpectedly". Emit the rejection as an `error` event when no callback was supplied, matching what a `net.Socket` does, so `Connection` reports it. Writes that do pass a callback keep receiving the error there.
Author
|
@charmander friendly ping on this one when you have a moment. It's the write-error half of #3757 you mentioned, CI is green and it still merges cleanly. Happy to adjust anything. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Covers the diagnosability half of #3757. It does not claim to fix the hang itself.
CloudflareSocket.write()defaulted its callback to a no-op.Connection._send()writes without a callback, so a rejectedWritableStreamDefaultWriter.write()was swallowed and the query sat unsettled until the socket closed with the genericConnection terminated unexpectedly.The callback is now optional. When none is supplied the error is emitted on the socket, which is what
net.Socketdoes and whatClient._handleErrorEventalready handles. Writes that pass a callback are unchanged.Tests: one new test fails on main and passes here, plus one control pinning the callback path from #3747. tsc, prettier and eslint are clean.
AI tooling helped trace and draft this; I ran the tests and own the change.