Skip to content

Double-delivery via _process_again window between ErrorResponse and ReadyForQuery #68

@SeanTAllen

Description

@SeanTAllen

After the query-in-flight sub-state machine refactoring (#67), the ReadyForQuery(non-idle) double-delivery is fixed. However, a separate double-delivery window remains due to _process_again.

_ResponseMessageParser processes one message per call, then schedules s._process_again() (a behavior call) to process the next buffered message. This creates a scheduling window between consecutive messages where other behaviors can execute:

  1. ErrorResponse arrives — on_error_response delivers the error to the receiver
  2. _process_again is scheduled as a behavior call
  3. close() behavior executes before _process_againon_shutdown iterates the queue and sends SessionClosed to the same receiver (double delivery)
  4. _process_again would have processed ReadyForQuery and dequeued, but it's too late

This is a pre-existing issue (present before #67) and affects any pair of messages where the first delivers a result/error and the second dequeues the query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions