To Our Amazing Educators Everywhere,
Happy Teacher Appreciation Week!
Found this content helpful? Log in or sign up to leave a like!
Attaching the full trace error as a file, but including the top part here. I recognize that this might be something internal, but https://github.com/MagicStack/asyncpg/issues/309 indicates perhaps not.
2023-09-25 13:03:18,678 - ERROR - (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.ConnectionDoesNotExistError'>: connection was closed in the middle of operation
[SQL: SELECT pg_catalog.pg_namespace.nspname
FROM pg_catalog.pg_namespace
WHERE pg_catalog.pg_namespace.nspname = $1::VARCHAR]
[parameters: ('canvas_logs',)]
(Background on this error at: https://sqlalche.me/e/20/dbapi)
Traceback (most recent call last):
File "/apps/software/standard/core/anaconda/2020.11-py3.8/lib/python3.8/asyncio/selector_events.py", line 848, in _read_ready__data_received
data = self._sock.recv(self.max_size)
TimeoutError: [Errno 110] Connection timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/dzt2aq/.local/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 528, in _prepare_and_execute
prepared_stmt, attributes = await adapt_connection._prepare(
File "/home/dzt2aq/.local/lib/python3.8/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 778, in _prepare
prepared_stmt = await self._connection.prepare(
File "/home/dzt2aq/.local/lib/python3.8/site-packages/asyncpg/connection.py", line 565, in prepare
return await self._prepare(
File "/home/dzt2aq/.local/lib/python3.8/site-packages/asyncpg/connection.py", line 583, in _prepare
stmt = await self._get_statement(
File "/home/dzt2aq/.local/lib/python3.8/site-packages/asyncpg/connection.py", line 397, in _get_statement
statement = await self._protocol.prepare(
File "asyncpg/protocol/protocol.pyx", line 168, in prepare
asyncpg.exceptions.ConnectionDoesNotExistError: connection was closed in the middle of operation
It seems as if your PostgreSQL server is closing the connection while SQLAlchemy (a Python library that DAP client library uses internally) is doing a schema discovery (by querying information from system tables in pg_catalog). You would need to check the PostgreSQL server log for the root cause. Some of the operations in DAP client library involve long-running sessions and transactions, and your PostgreSQL server might be configured not to tolerate these.
We are assessing the possibility of a major revision of DAP client library, which would, as a side effect, reduce the time DAP client library needs to keep a database server connection open, reducing the likelihood of these errors. Until this overhaul happens, the best course of action is to adjust PostgreSQL server configuration to be more forgiving.
Thank you!
To participate in the Instructure Community, you need to sign up or log in:
Sign In