PostgreSQL version: PostgreSQL 12.8 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit (docker)
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: yes
Python version: 3.10.1
Platform: ubuntu
Do you use pgbouncer?: no & yes (same result)
Did you install asyncpg with pip?: yes
If you built asyncpg locally, which version of Cython did you use?:
Can the issue be reproduced under both asyncio and
uvloop?: yes
When I try to reproduce example with aiohttp from documentationI get the error:
2022-10-12 16:58:42,613 [ERROR] aiohttp.server: Error handling request
Traceback (most recent call last):
File "/home/mario/workspace/pk-alert-manager/testt.py", line 23, in handle
async with connection.transaction():
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/transaction.py", line 62, in __aenter__
await self.start()
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/transaction.py", line 138, in start
await self._connection.execute(query)
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/connection.py", line 318, in execute
return await self._protocol.query(query, timeout)
File "asyncpg/protocol/protocol.pyx", line 338, in query
RuntimeError: Task <Task pending name='Task-24' coro=<RequestHandler._handle_request() running at /home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/aiohttp/web_protocol.py:435> cb=[Task.task_wakeup()]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/home/mario/workspace/pk-alert-manager/testt.py", line 21, in handle
async with pool.acquire() as connection:
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/pool.py", line 224, in release
raise ex
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/pool.py", line 214, in release
await self._con.reset(timeout=budget)
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/connection.py", line 1367, in reset
await self.execute(reset_query, timeout=timeout)
File "/home/mario/workspace/pk-alert-manager/venv/lib/python3.10/site-packages/asyncpg/connection.py", line 318, in execute
return await self._protocol.query(query, timeout)
File "asyncpg/protocol/protocol.pyx", line 323, in query
File "asyncpg/protocol/protocol.pyx", line 707, in asyncpg.protocol.protocol.BaseProtocol._check_state
asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
When I try to reproduce example with aiohttp from documentation I get the error: