pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
libpq: pipeline mode might desynchronize client and server
3+ messages / 3 participants
[nested] [flat]

* libpq: pipeline mode might desynchronize client and server
@ 2023-11-22 00:13  Ivan Trofimov <i.trofimow@yandex.ru>
  0 siblings, 1 reply; 3+ messages in thread

From: Ivan Trofimov @ 2023-11-22 00:13 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Hi!

This is a follow up on 
https://www.postgresql.org/message-id/17948-fcace7557e449957@postgresql.org.

Libpq in pipeline mode considers '< 2TDCEZ' a sufficient response to
'> BDESS', when according to specification one more 'Z' is expected.
This leads to client <-> server desynchronization, when libpq parses the 
very next message server sends (which is Z, as expected).

A bit more context and a MRE: 
https://github.com/itrofimow/libpq_protocol_desync

I'm pretty sure that this branch 
https://github.com/postgres/postgres/blob/3af101ce8be8eeb0e8adc61e293b5d12989f68be/src/interfaces/li... 
should be adjusted to handle the case and do not match error response 
against sync query.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: libpq: pipeline mode might desynchronize client and server
@ 2023-11-24 02:49  Michael Paquier <michael@paquier.xyz>
  parent: Ivan Trofimov <i.trofimow@yandex.ru>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2023-11-24 02:49 UTC (permalink / raw)
  To: Ivan Trofimov <i.trofimow@yandex.ru>; +Cc: pgsql-bugs@lists.postgresql.org

On Wed, Nov 22, 2023 at 03:13:46AM +0300, Ivan Trofimov wrote:
> This is a follow up on
> https://www.postgresql.org/message-id/17948-fcace7557e449957@postgresql.org.

Is this the same bug as discussed on this other thread?  Why is there
a need for a second thread?

> Libpq in pipeline mode considers '< 2TDCEZ' a sufficient response to
> '> BDESS', when according to specification one more 'Z' is expected.
> This leads to client <-> server desynchronization, when libpq parses the
> very next message server sends (which is Z, as expected).
> 
> A bit more context and a MRE:
> https://github.com/itrofimow/libpq_protocol_desync
> 
> I'm pretty sure that this branch https://github.com/postgres/postgres/blob/3af101ce8be8eeb0e8adc61e293b5d12989f68be/src/interfaces/li...
> should be adjusted to handle the case and do not match error response
> against sync query.

Could you attach the test case to the original thread please (assuming
that this is the same problem)?  If this data is deleted by github,
then any data making a problem reproducible would be lost.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: libpq: pipeline mode might desynchronize client and server
@ 2023-11-24 09:50  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2023-11-24 09:50 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Ivan Trofimov <i.trofimow@yandex.ru>; pgsql-bugs@lists.postgresql.org

On 2023-Nov-24, Michael Paquier wrote:

> On Wed, Nov 22, 2023 at 03:13:46AM +0300, Ivan Trofimov wrote:

> > Libpq in pipeline mode considers '< 2TDCEZ' a sufficient response to
> > '> BDESS', when according to specification one more 'Z' is expected.
> > This leads to client <-> server desynchronization, when libpq parses the
> > very next message server sends (which is Z, as expected).
> > 
> > A bit more context and a MRE:
> > https://github.com/itrofimow/libpq_protocol_desync
> > 
> > I'm pretty sure that this branch https://github.com/postgres/postgres/blob/3af101ce8be8eeb0e8adc61e293b5d12989f68be/src/interfaces/li...
> > should be adjusted to handle the case and do not match error response
> > against sync query.
> 
> Could you attach the test case to the original thread please (assuming
> that this is the same problem)?  If this data is deleted by github,
> then any data making a problem reproducible would be lost.

FWIW I started looking at this problem a couple of days ago.  I had not
noticed the previous thread.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-11-24 09:50 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 00:13 libpq: pipeline mode might desynchronize client and server Ivan Trofimov <i.trofimow@yandex.ru>
2023-11-24 02:49 ` Michael Paquier <michael@paquier.xyz>
2023-11-24 09:50   ` Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox