Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
letrec opened this issue Jun 23, 2021 · 0 comments

Comments

@letrec
Copy link

letrec commented Jun 23, 2021

  • 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 <UVPoll closed=True 0x7fe55db27270>; 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 <UVPoll closed=True 0x7fe55db27270>; 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant