postgresql/src/interfaces
Alvaro Herrera b8ba7344e9
Fix handling of errors in libpq pipelines
The logic to keep the libpq command queue in sync with queries that have
been processed had a bug when errors were returned for reasons other
than problems in queries -- for example, when a connection is lost.  We
incorrectly consumed an element from the command queue every time, but
this is wrong and can lead to the queue becoming empty ahead of time,
leading to later malfunction: PQgetResult would return nothing,
potentially causing the calling application to enter a busy loop.

Fix by making the SYNC queue element a barrier that can only be consumed
when a SYNC message is received.

Backpatch to 14.

Reported by: Иван Трофимов (Ivan Trofimov) <i.trofimow@yandex.ru>
Discussion: https://postgr.es/m/17948-fcace7557e449957@postgresql.org
2023-12-05 12:43:24 +01:00
..
ecpg Remove distprep 2023-11-06 15:18:04 +01:00
libpq Fix handling of errors in libpq pipelines 2023-12-05 12:43:24 +01:00
Makefile Fix parallel make when running make install before make all 2011-03-08 23:52:29 +02:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00