Skip to content

Release 0.5.5: send the CancelRequest before closing the socket - #6

Merged
zaiev merged 2 commits into
mainfrom
send-the-cancelrequest-before-closing-the-socket
Dec 3, 2026
Merged

zaiev merged 2 commits into
mainfrom
send-the-cancelrequest-before-closing-the-socket

Conversation

@zaiev

@zaiev zaiev commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Why

A statement given up on, by a timeout, a cancellation or a raise from the caller's callback, was cancelled at the server only after the connection's socket had closed. A pooling proxy finds the session a cancel names by its client, and drops one for a client that has already disconnected, so the statement ran on for nobody. This carries on #2 by @Sanguinor88, whose commit it keeps as author: the socket now closes only once the cancel is done. Keeping the connection open meanwhile would let it take statements while the cancel is on its way, and one could run at the server, be cancelled in the given-up one's place, or answer as lost where nothing was meant to be sent, so the connection is detached first.

Changes

  • A statement given up on is cancelled at the server before the connection's socket closes, not after.
  • From the moment it is given up on, the connection refuses new statements as closed, as before, while the cancel is on its way.
  • Released as 0.5.5; AGENTS.md names the switch make setup makes, postgres-eio, as the Makefile does.

Verified

  • 54.2.8 nothing is sent while a cancel is on its way failed on Send the CancelRequest before closing the socket #2 as it stood (the statement was taken) and passes now; 54.2.8 a cancel is sent before the connection closes passes.
  • make test: 366 tests pass against the test Postgres; make lint: no findings; make docs regenerated agents/.

A statement given up on, by a timeout, a cancellation or a raise from
the caller's callback, was cancelled at the server only after the
connection's socket had closed. A pooling proxy finds the session a
cancel names by its client, and drops one for a client that has already
disconnected, so the statement ran on for nobody.

The socket now closes only once the cancel is done. The connection is
still detached first, its unsent statements refused as closed: were it
to take statements while the cancel is on its way, one could run at the
server, be cancelled in the given-up one's place, or answer as lost
where nothing was meant to be sent.
@zaiev zaiev changed the title Send the CancelRequest before closing the socket Release 0.5.5: send the CancelRequest before closing the socket Dec 3, 2026
@zaiev
zaiev merged commit 430d48a into main Dec 3, 2026
4 checks passed
@zaiev
zaiev deleted the send-the-cancelrequest-before-closing-the-socket branch December 3, 2026 22:29
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