[FSQL] Prevent client socket errors from escalating to pglite server crashes#10845
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the error handling for Postgres client sockets in pgliteServer.ts. Instead of escalating client socket errors to server-level errors, they are now logged as debug messages and the socket is destroyed. I have no feedback to provide.
yuchenshi
approved these changes
Jul 24, 2026
| // to server-level errors. | ||
| socket.on("error", (err) => { | ||
| server.emit("error", err); | ||
| logger.debug("Postgres client socket error (expected during request cancellation):", err); |
Member
There was a problem hiding this comment.
I think this is fine but the logs can be a bit misleading if it happens outside of cancellation. Maybe add as a newline suffix e.g. "If this happened during request cancellation, it's expected and harmless"
Member
|
Please add an CHANGELOG entry |
mtr002
enabled auto-merge (squash)
July 24, 2026 21:43
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.
Description
This PR fixes Issue#10821
Cancelling an in-flight Data Connect request makes the Go backend Postgres driver send a CancelRequest frame on a new TCP connection. pg-gateway throws Unexpected initial message, which pgliteServer.ts currently re-emits as a server error—causing dataconnectEmulator.ts to call cleanShutdown() and stop all emulators.
This PR decouples client socket errors from server-level errors in pgliteServer.ts. Per-socket errors are now logged and destroyed so single connection drops don't crash the emulator stack. Real server errors (EADDRINUSE) are still handled normally.
Scenarios Tested
Sample Commands