]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix: force a sync exiting the pipeline mode 722/head
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 26 Jan 2024 00:29:29 +0000 (00:29 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 26 Jan 2024 00:34:13 +0000 (00:34 +0000)
Without it there may be a deadlock and we would be waiting to fetch a
result that will never come.

Close #685.

docs/news.rst
psycopg/psycopg/_pipeline.py

index c5a6a7608b2f0c9dc3d6d21da92d54bb3c551477..f511a39d32b81e59235d839c02428b75679e4728 100644 (file)
@@ -7,6 +7,15 @@
 ``psycopg`` release notes
 =========================
 
+Future releases
+---------------
+
+Psycopg 3.1.18 (unreleased)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fix possible deadlock on pipeline exit (:ticket:`685`).
+
+
 Current release
 ---------------
 
index 7064f6038683fbf5b0e7a34891091aefcfa9950d..6b09c69f0de7fe872162ab94db46ede8bd50777c 100644 (file)
@@ -132,8 +132,7 @@ class BasePipeline:
             self._enqueue_sync()
             yield from self._communicate_gen()
         finally:
-            # No need to force flush since we emitted a sync just before.
-            yield from self._fetch_gen(flush=False)
+            yield from self._fetch_gen(flush=True)
 
     def _communicate_gen(self) -> PQGen[None]:
         """Communicate with pipeline to send commands and possibly fetch