Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Reproducer of libpq <-> PostgreSQL protocol desync in client pipeline mode

License

Notifications You must be signed in to change notification settings

itrofimow/libpq_protocol_desync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a reproducer of https://www.postgresql.org/message-id/flat/17948-fcace7557e449957%40postgresql.org.
One could execute docker-compose up --build from the root directory to run it.

When this packet exchange occurs between libpq and PG server

> BDESS
< 2TDCEZ

libpq switches connection into PGASYNC_IDLE state, even though it sent two Syncs and only got one ReadyForQuery in response.
This is problematic, because the very next packet server will send is the second ReadyForQuery,
which libpq interprets as a response to the next query, when in reality it's the response to the second Sync message.

We are seing such < 2TDCEZ responses in production, where E is canceling statement due to statement timeout.Fpostgres.c.L3328.RProcessInterrupts, and this error relates to the statement being executed, not to the Sync request.
PostgreSQL sending both C and E for the same statement seems peculiar if not buggy (we've also seen < 2TDE),
but nonetheless we think libpq shouldn't accept E as a valid response to S.

About

Reproducer of libpq <-> PostgreSQL protocol desync in client pipeline mode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published