Hi,
Im experiencing many internal server error, almost everywhere in the Aleph UI:
- login
- creating investigations
- listing datasets
- listing notifications
- etc.
It happens when my aleph session stay open a long time or when trying to relogin. I can’t explain it. The problem is solve when refreshing the aleph UI (ctrl+r).
The following traceback was taken at login.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
self.dialect.do_execute(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 921, in do_execute
cursor.execute(statement, parameters)
psycopg2.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py", line 176, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/aleph/aleph/views/sessions_api.py", line 140, in oauth_callback
role = handle_oauth(oauth.provider, oauth_token)
File "/aleph/aleph/oauth.py", line 92, in handle_oauth
role = Role.by_foreign_id(role_id)
File "/aleph/aleph/model/role.py", line 175, in by_foreign_id
return q.first()
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 2743, in first
return self.limit(1)._iter().first() # type: ignore
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 2842, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 2262, in execute
return self._execute_internal(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/session.py", line 2144, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
result = conn.execute(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1412, in execute
return meth(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1844, in _execute_context
return self._exec_single_context(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1984, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 2339, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1965, in _exec_single_context
self.dialect.do_execute(
File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 921, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
[SQL: SELECT role.foreign_id AS role_foreign_id, role.name AS role_name, role.email AS role_email, role.type AS role_type, role.api_key AS role_api_key, role.is_admin AS role_is_admin, role.is_muted AS role_is_muted, role.is_tester AS role_is_tester, role.is_blocked AS role_is_blocked, role.password_digest AS role_password_digest, role.reset_token AS role_reset_token, role.locale AS role_locale, role.last_login_at AS role_last_login_at, role.id AS role_id, role.deleted_at AS role_deleted_at, role.created_at AS role_created_at, role.updated_at AS role_updated_at
FROM role
WHERE role.deleted_at IS NULL AND role.foreign_id = %(foreign_id_1)s
LIMIT %(param_1)s]
[parameters: {'foreign_id_1': 'oidc:<UUID>', 'param_1': 1}]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Debug log:
{
"logger": "aleph",
"timestamp": "2024-12-30 08:07:07.063865",
"exception": "Traceback",
"v": "4.0.2",
"ua": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
"begin_time": "2024-12-30T08:07:07.004322",
"method": "GET",
"url": "http://my-aleph-instance/api/2/sessions/callback?state=Nwo1glU8X3m1Q9pNBjzpPr50kyIm2k&session_state=4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b&code=05227ab4-b717-48e9-9263-b3555db66d25.4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b.2e7b7a38-d6b6-44d4-bc6b-d38c50a59395",
"endpoint": "sessions_api.oauth_callback",
"session_id": null,
"locale": "fr",
"referrer": null,
"role_id": null,
"trace_id": "f7f2869a-487f-4a8c-a7f0-f4ffaba816b9",
"path": "/api/2/sessions/callback?state=Nwo1glU8X3m1Q9pNBjzpPr50kyIm2k&session_state=4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b&code=05227ab4-b717-48e9-9263-b3555db66d25.4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b.2e7b7a38-d6b6-44d4-bc6b-d38c50a59395",
"ip": "",
"message": "Exception on /api/2/sessions/callback [GET]",
"severity": "ERROR"
}
{
"logger": "aleph.views.base_api",
"timestamp": "2024-12-30 08:07:07.065063",
"exception": "Traceback",
"v": "4.0.2",
"ua": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
"begin_time": "2024-12-30T08:07:07.004322",
"method": "GET",
"url": "http://my-aleph-instance/api/2/sessions/callback?state=Nwo1glU8X3m1Q9pNBjzpPr50kyIm2k&session_state=4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b&code=05227ab4-b717-48e9-9263-b3555db66d25.4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b.2e7b7a38-d6b6-44d4-bc6b-d38c50a59395",
"endpoint": "sessions_api.oauth_callback",
"session_id": null,
"locale": "fr",
"referrer": null,
"role_id": null,
"trace_id": "f7f2869a-487f-4a8c-a7f0-f4ffaba816b9",
"path": "/api/2/sessions/callback?state=Nwo1glU8X3m1Q9pNBjzpPr50kyIm2k&session_state=4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b&code=05227ab4-b717-48e9-9263-b3555db66d25.4acd2fbd-4a06-4a62-b8f3-0b99796a0d4b.2e7b7a38-d6b6-44d4-bc6b-d38c50a59395",
"ip": "",
"message": "InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.",
"severity": "ERROR"
}
Have you already seen this error?
Stack:
- aleph:4.0.2
- ingest-file:4.0.2
- aleph-ui-production:4.0.2