This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author piro
Recipients asvetlov, hynek, lukasz.langa, piro, uriyyo, yselivanov
Date 2021-03-07.23:37:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I have stumbled in this bug, or something similar, implementing psycopg3 async connection pool. A function such as the following fails but only in Python 3.6 (tested 3.6.12):

    async def wait(self, timeout: float) -> AsyncConnection:
        """Wait for a connection to be set and return it.
        Raise an exception if the wait times out or if fail() is called.
        async with self._cond:
            if not (self.conn or self.error):
                    await asyncio.wait_for(self._cond.wait(), timeout)
                except asyncio.TimeoutError:
                    # HERE
                    self.error = PoolTimeout(
                        f"couldn't get a connection after {timeout} sec"

In python 3.6, printing self._cond.locked() in the HERE position gives False, even if it's inside the with block. Everything grinds to a halt afterwards.

However I don't have the same problem in other Python versions (3.7.10, 3.8.5 among the ones tested) so I'm not sure it is the same issue.

Is this a manifestation of the same bug or a different one? Is there any workaround or should I make the async pool just not supported on Python 3.6?
Date User Action Args
2021-03-07 23:37:37pirosetrecipients: + piro, asvetlov, lukasz.langa, hynek, yselivanov, uriyyo
2021-03-07 23:37:37pirosetmessageid: <>
2021-03-07 23:37:37pirolinkissue42600 messages
2021-03-07 23:37:37pirocreate