You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When statement gets cancelled after setting a timeout, only a coroutine CancelledError is raised without any context. I would expect some more information why the query has been cancelled:
Reproduce:
import asyncio
from aiopg.sa import create_engine
def create_eng():
engine = create_engine(
"postgresql://postgres:postgres@localhost:5432/postgres?sslmode=disable",
options="-c statement_timeout={}".format(1000),
)
loop = asyncio.get_event_loop()
engine = loop.run_until_complete(engine)
return engine
async def main(engine):
async with engine.acquire() as conn:
async with conn.execute("SELECT * FROM pg_sleep(5)") as result:
rows = await result.fetchall()
print(rows)
asyncio.get_event_loop().run_until_complete((main(create_eng())))
Expected output:
any message saying that execute statement timed out
Actual output:
Traceback (most recent call last):
File "aiopg_timeout_minimal_example.py", line 23, in <module>
asyncio.get_event_loop().run_until_complete((main(create_eng())))
File "/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete
return future.result()
concurrent.futures._base.CancelledError
The text was updated successfully, but these errors were encountered:
gmiejski
changed the title
Timed out statements raises poor exception
Timed out statements raises poor exception content
Feb 5, 2019
GitMate.io thinks possibly related issues are #65 (Closing connection object throws exception), #67 (Queries start failing after some time), #9 (Publish psycopg2 exceptions in aiopg module), #78 (SQL statements logging), and #110 (Exception in Connection.del when database connection has failed.).
@gmiejski Hi.
unfortunately CanceledError does not support extended traceback. You can read it here and here.
But I think. We can add loop.call_exception_handler which can be overridden with loop.set_exception_handler and with the help of the standard python logger, you can send errors in sentry... the here
Versions:
When statement gets cancelled after setting a timeout, only a coroutine
CancelledError
is raised without any context. I would expect some more information why the query has been cancelled:Reproduce:
Expected output:
Actual output:
The text was updated successfully, but these errors were encountered: