Apply notification receive budgets to complete messages - #20
Merged
Merged
Conversation
wait_for_notification(conn; timeout=...) stopped timing the read after the first byte of a PostgreSQL message, so a partly received message could block past the timeout. The timeout now covers the complete message, and partial PostgreSQL, TLS, and GSS input stays buffered for the next read. Idle validation and notification waits share the same complete-frame check. This is #16, which merged into the #15 branch after #15 had already landed, so it never reached main. It is ported onto current main with both test-registration lists kept and the docstring shortened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quinnj
referenced
this pull request
Sep 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
wait_for_notification(conn; timeout=...)stopped timing the read after the first byte of a PostgreSQL message, so a partly received message (a stalled peer, or a proxy that splits packets) could block past the timeout. The timeout now covers the complete message. Partial PostgreSQL messages and partial TLS and GSS records stay buffered, so the next call resumes them.Postgres.isvalidandwait_for_notificationnow share one complete-frame check (API.take_frame!). Notification waits collect input without blocking, then wait for TCP readiness with the remaining deadline.This is #16. It was merged into the #15 branch two minutes after #15 had been squash-merged, so it never reached
mainand is not in 2.2.1. This PR ports it onto currentmain. The only conflict was the test-runner include list (both sides kept). The docstring is shortened; the code is unchanged from #16.New tests cover fragmented notifications over plain TCP, TLS 1.2/1.3 and GSS, truncation at EOF, callback failures, and time spent in callbacks counting toward the timeout.
Co-authored by Codex
🤖 Generated with Claude Code