Skip to content

Process query cycle messages synchronously to prevent double-delivery#69

Merged
SeanTAllen merged 1 commit intomainfrom
sean/fix-process-again-double-delivery
Feb 9, 2026
Merged

Process query cycle messages synchronously to prevent double-delivery#69
SeanTAllen merged 1 commit intomainfrom
sean/fix-process-again-double-delivery

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

_ResponseMessageParser previously processed one message per call and yielded via _process_again() between each message. This created a window where close() could execute between ErrorResponse and ReadyForQuery, causing on_shutdown to deliver SessionClosed to a receiver that already received the error.

Now loops synchronously within a query cycle, yielding only after ReadyForQuery. If a callback triggers shutdown, on_shutdown clears the read buffer, causing the next parse to return None and exit the loop naturally.

Closes #68

_ResponseMessageParser previously processed one message per call and
yielded via _process_again between each message. This created a window
where close() could execute between ErrorResponse and ReadyForQuery,
causing on_shutdown to deliver SessionClosed to a receiver that already
received the error — a double-delivery of pg_query_failed.

Now loops synchronously within a query cycle, yielding only after
ReadyForQuery. If a callback triggers shutdown, on_shutdown clears the
read buffer, causing the next parse to return None and exit the loop
naturally.

Closes #68
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Feb 8, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Feb 8, 2026
@SeanTAllen SeanTAllen merged commit 9836d93 into main Feb 9, 2026
11 checks passed
@SeanTAllen SeanTAllen deleted the sean/fix-process-again-double-delivery branch February 9, 2026 00:03
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Feb 9, 2026
github-actions bot pushed a commit that referenced this pull request Feb 9, 2026
github-actions bot pushed a commit that referenced this pull request Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Double-delivery via _process_again window between ErrorResponse and ReadyForQuery

2 participants