aiopg icon indicating copy to clipboard operation
aiopg copied to clipboard

AttributeError: 'Connection' object has no attribute '_waiter'

Open decaz opened this issue 6 years ago • 4 comments

Unfortunately I can't reproduce it for now but I've got the following exception for the first time:

AttributeError: 'Connection' object has no attribute '_waiter'
  File "asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "aiopg/connection.py", line 103, in _ready
    waiter = self._waiter
  • CPython 3.8.0
  • aiopg==1.0.0

decaz avatar Nov 28 '19 16:11 decaz

And meanwhile the following exceptions were raised just once:

TimeoutError: null
  File "aiopg/connection.py", line 207, in _poll
    await asyncio.wait_for(self._waiter, timeout, loop=self._loop)
  File "asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()

AttributeError: 'Connection' object has no attribute '_loop'
  File "aiopg/connection.py", line 209, in _poll
    await asyncio.shield(cancel(), loop=self._loop)

AttributeError: 'Connection' object has no attribute '_cancelling'
  File "asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "my/service.py", line 543, in connect_db
    async with aiopg.connect(**connect_kwargs) as connection:
  File "aiopg/utils.py", line 94, in __aenter__
    self._obj = await self._coro
  File "aiopg/connection.py", line 560, in _connect
    oids = await self._get_oids()
  File "aiopg/connection.py", line 531, in _get_oids
    await cur.execute(
  File "aiopg/cursor.py", line 113, in execute
    await self._conn._poll(waiter, timeout)
  File "aiopg/connection.py", line 219, in _poll
    if self._cancelling:

decaz avatar Nov 28 '19 16:11 decaz

@vir-mir @asvetlov I didn't find that these attributes are being deleted somewhere. Maybe this issue somehow connected with weakref behavior in Python 3.8? I don't understand, but how is it possible?

decaz avatar Nov 28 '19 22:11 decaz

This is pretty weird. I am using python3.8 and aiopg 1.0.0 in commercial production. and I didn't have this problem.

vir-mir avatar Nov 29 '19 11:11 vir-mir

Yes.. I started testing Python 3.8 and this exceptions appeared 2 weeks later. And they disappeared after ~75 seconds after they were first seen.

decaz avatar Nov 29 '19 12:11 decaz