From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Ivan Trofimov <i.trofimow@yandex.ru>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17948: libpq seems to misbehave in a pipelining corner case
Date: Mon, 4 Dec 2023 19:47:51 +0100
Message-ID: <202312041847.iur3zphjejur@alvherre.pgsql> (raw)
In-Reply-To: <7f6e2986-158d-4650-e8df-56e9bfc48da1@yandex.ru>
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)
Attachments:
[text/x-diff] v2-0001-Fix-handling-of-errors-in-libpq-pipelines.patch (0B, ../202312041847.iur3zphjejur@alvherre.pgsql/2-v2-0001-Fix-handling-of-errors-in-libpq-pipelines.patch)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: alvherre@alvh.no-ip.org, i.trofimow@yandex.ru, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17948: libpq seems to misbehave in a pipelining corner case
In-Reply-To: <202312041847.iur3zphjejur@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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