Skip to content

Apply notification receive budgets to complete messages - #20

Merged
quinnj merged 1 commit into
mainfrom
fix/notification-receive-budget
Sep 28, 2026
Merged

quinnj merged 1 commit into
mainfrom
fix/notification-receive-budget

Conversation

@quinnj

@quinnj quinnj commented Sep 28, 2026

Copy link
Copy Markdown
Member

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.isvalid and wait_for_notification now 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 main and is not in 2.2.1. This PR ports it onto current main. 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

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
quinnj merged commit 1fb05b0 into main Sep 28, 2026
16 checks passed
quinnj referenced this pull request Sep 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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