asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

Handle PROTOCOL_CANCELLED (state 3) in _dispatch_result.

Open mnbbrown opened this issue 2 months ago • 1 comments

Prior to this patch the state machine did not handle results arriving after cancellation. This add explicit support for that scenario by keeping track of the state prior to cancellation (cancelled_from_state), and using cancelled_from_state when consuming the results.

The alternative option is just silently dropping the results (similar to PROTOCOL_TERMINATING).

Would maybe close https://github.com/MagicStack/asyncpg/issues/490

mnbbrown avatar Oct 26 '25 08:10 mnbbrown

Upon reflection I'm not sure this is the best approach.. it would possibly leave a connection in a state that's unexpected by the client. Needs further thought.

mnbbrown avatar Oct 26 '25 11:10 mnbbrown