Re: libpq: pipeline mode might desynchronize client and server

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ivan Trofimov <i(dot)trofimow(at)yandex(dot)ru>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: libpq: pipeline mode might desynchronize client and server
Date: 2023-11-24 02:49:21
Message-ID: ZWAPMRqhifJ8YVNW@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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/libpq/fe-exec.c#L2124
> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2023-11-24 04:00:01 Re: BUG #17828: postgres_fdw leaks file descriptors on error and aborts aborted transaction in lack of fds
Previous Message Stefan Kaltenbrunner 2023-11-23 20:04:01 Re: Misconfiguration on SSL for download.postgresql.org ?