]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
fix: force a sync exiting the pipeline mode
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 23:52:52 +0000 (23:52 +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 3be638ed4d2441f69b70f3447330a8dca2446a97..3c8a2e1d3ef2cb1dd3425244fa454a3564b2ce72 100644 (file)
@@ -30,6 +30,12 @@ Psycopg 3.2 (unreleased)
 .. __: https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types
 
 
+Psycopg 3.1.18 (unreleased)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fix possible deadlock on pipeline exit (:ticket:`685`).
+
+
 Current release
 ---------------
 
index 909310eba0e220122ca918bf528f1218e40a3bdb..05d0beb64409f491ccc4a57efdcc5031bfa55b83 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