Re: BUG #17948: libpq seems to misbehave in a pipelining corner case - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #17948: libpq seems to misbehave in a pipelining corner case
Date
Msg-id 202312041847.iur3zphjejur@alvherre.pgsql
Whole thread Raw
In response to Re: BUG #17948: libpq seems to misbehave in a pipelining corner case  (Ivan Trofimov <i.trofimow@yandex.ru>)
List pgsql-bugs
On 2023-Dec-02, Ivan Trofimov wrote:

> Thank you for looking into this, much appreciated.
> 
> Yes, I can confirm that the patch fixes both the busy-loop and
> client<->server desynchronization problem for me.

Great, thanks for the confirmation.

Mulling it over while writing better comments for it, I realized that it
could still be somewhat brittle, and it's also confusing that part of
the logic is in PQgetResult and the rest in pqCommandQueueAdvance; so I
moved it all to the latter, which also lets me document it more clearly
in the comments.  I addressed the brittleness by changing what to test:
instead of just "it's an error, then do nothing if the queue has a
SYNC", we can verify that we actually have a matching SYNC in both
places.  This seems much better.

Patch v2 attached.  I'll be pushing this to 14+ tomorrow, unless
something ugly comes up.

Thanks for reporting this problem!

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

Attachment

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18225: chdb's s3 table function crashes postgresql with plpython3
Next
From: Richard Guo
Date:
Subject: Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN