aio-libs / aio-libs/aiopg

unable to perform operation on <UVPoll closed=True 0x7fe55db27270>; the handler is closed

Ouverte
#856 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
1.4k
Forks
170
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

- aiopg version: 1.2.1
- PostgreSQL version: 12.7
- Python version: 3.8
- Platform: Linux
- Did you install aiopg with pip?: Yes

I have a server application where after some time being idle the below occurs:

```
unable to perform operation on ; the handler is closed
Traceback (most recent call last):
async with pool.acquire() as conn:
File "/home/test/venv/lib/python3.8/site-packages/aiopg/utils.py", line 69, in __aenter__
self._obj = await self._coro
File "/home/test/venv/lib/python3.8/site-packages/aiopg/pool.py", line 164, in _acquire
await self._fill_free_pool(True)
File "/home/test/venv/lib/python3.8/site-packages/aiopg/pool.py", line 211, in _fill_free_pool
conn = await connect(
File "/home/test/venv/lib/python3.8/site-packages/aiopg/connection.py", line 38, in connect
coro = Connection(
File "/home/test/venv/lib/python3.8/site-packages/aiopg/connection.py", line 90, in __init__
self._loop.add_reader(self._fileno, self._ready, self._weakref)
File "uvloop/loop.pyx", line 2419, in uvloop.loop.Loop.add_reader
File "uvloop/loop.pyx", line 777, in uvloop.loop.Loop._add_reader
File "uvloop/handles/poll.pyx", line 104, in uvloop.loop.UVPoll.start_reading
File "uvloop/handles/poll.pyx", line 39, in uvloop.loop.UVPoll._poll_start
File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on ; the handler is closed
```

I suspect the connection gets stale, but the pooling logic doesn't check for that.
It looks like the check at https://github.com/aio-libs/aiopg/blob/master/aiopg/pool.py#L324 needs to account for that similar to https://github.com/aio-libs/aiomysql/pull/339/files#diff-9ccf7da6bb12e81af8f2eefbd1c5b43ebc6695d4d750a29683e90024156bc03fR151

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.