Daniele Varrazzo <daniele.varra...@gmail.com> added the comment:

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):
                try:
                    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?

----------
nosy: +piro

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42600>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to