Zukunftsmusik / pss-fleet-data-api

A REST API server for Pixel Starships Fleet Data
MIT License
1 stars 0 forks source link

After some inactivity an Internal Server Error is thrown #20

Open Zukunftsmusik opened 5 days ago

Zukunftsmusik commented 5 days ago

Error log

2024-09-18T08:21:01.358816214Z [SQL: SELECT collection.collection_id, collection.data_version, collection.collected_at, collection.duration, collection.fleet_count, collection.user_count, collection.tournament_running, collection.max_tournament_battle_attempts
2024-09-18T08:21:01.358829364Z FROM collection
2024-09-18T08:21:01.358838693Z WHERE EXTRACT(month FROM collection.collected_at) != EXTRACT(month FROM collection.collected_at + $1::INTERVAL) ORDER BY collection.collected_at ASC
2024-09-18T08:21:01.358867100Z LIMIT $2::INTEGER OFFSET $3::INTEGER]
2024-09-18T08:21:01.358883918Z [parameters: (datetime.timedelta(seconds=3600), 1, 0)]
2024-09-18T08:21:01.358893428Z (Background on this error at: https://sqlalche.me/e/20/dbapi)
2024-09-18T08:21:01.358903743Z INFO: x.x.x.x:y - "GET /collections/?interval=month&desc=false&skip=0&take=1 HTTP/1.0" 500 Internal Server Error
2024-09-18T08:21:01.376709688Z ERROR: Exception in ASGI application
2024-09-18T08:21:01.376753693Z ConnectionResetError: [Errno 104] Connection reset by peer
2024-09-18T08:21:01.376761079Z
2024-09-18T08:21:01.376767083Z The above exception was the direct cause of the following exception:
2024-09-18T08:21:01.376772606Z
2024-09-18T08:21:01.376777741Z Traceback (most recent call last):
2024-09-18T08:21:01.376783596Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 835, in _start_transaction
2024-09-18T08:21:01.376790000Z await self._transaction.start()
2024-09-18T08:21:01.376818762Z File "/usr/local/lib/python3.12/site-packages/asyncpg/transaction.py", line 146, in start
2024-09-18T08:21:01.376824626Z await self._connection.execute(query)
2024-09-18T08:21:01.376829759Z File "/usr/local/lib/python3.12/site-packages/asyncpg/connection.py", line 350, in execute
2024-09-18T08:21:01.376835000Z result = await self._protocol.query(query, timeout)
2024-09-18T08:21:01.376839991Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.376844943Z File "asyncpg/protocol/protocol.pyx", line 374, in query
2024-09-18T08:21:01.376850136Z asyncpg.exceptions.ConnectionDoesNotExistError: connection was closed in the middle of operation
2024-09-18T08:21:01.376855817Z
2024-09-18T08:21:01.376898211Z The above exception was the direct cause of the following exception:
2024-09-18T08:21:01.376903596Z
2024-09-18T08:21:01.376908038Z Traceback (most recent call last):
2024-09-18T08:21:01.376912483Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2024-09-18T08:21:01.376917160Z self.dialect.do_execute(
2024-09-18T08:21:01.376922018Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
2024-09-18T08:21:01.376927107Z cursor.execute(statement, parameters)
2024-09-18T08:21:01.376932350Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 572, in execute
2024-09-18T08:21:01.376937380Z self._adapt_connection.await_(
2024-09-18T08:21:01.376942272Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only
2024-09-18T08:21:01.376947335Z return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
2024-09-18T08:21:01.376952656Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.376957059Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
2024-09-18T08:21:01.376962274Z value = await result
2024-09-18T08:21:01.376967200Z ^^^^^^^^^^^^
2024-09-18T08:21:01.376978838Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 508, in _prepare_and_execute
2024-09-18T08:21:01.376984373Z await adapt_connection._start_transaction()
2024-09-18T08:21:01.376992635Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 837, in _start_transaction
2024-09-18T08:21:01.376997943Z self._handle_exception(error)
2024-09-18T08:21:01.377002591Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 784, in _handle_exception
2024-09-18T08:21:01.377008457Z raise translated_error from error
2024-09-18T08:21:01.377013778Z sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_dbapi.Error: <class 'asyncpg.exceptions.ConnectionDoesNotExistError'>: connection was closed in the middle of operation
2024-09-18T08:21:01.377028173Z
2024-09-18T08:21:01.377032971Z The above exception was the direct cause of the following exception:
2024-09-18T08:21:01.377037714Z
2024-09-18T08:21:01.377042127Z Traceback (most recent call last):
2024-09-18T08:21:01.377046696Z File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
2024-09-18T08:21:01.377051835Z result = await app( # type: ignore[func-returns-value]
2024-09-18T08:21:01.377056477Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377061179Z File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
2024-09-18T08:21:01.377065880Z return await self.app(scope, receive, send)
2024-09-18T08:21:01.377070245Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377074816Z File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
2024-09-18T08:21:01.377079941Z await super().__call__(scope, receive, send)
2024-09-18T08:21:01.377084414Z File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
2024-09-18T08:21:01.377089463Z await self.middleware_stack(scope, receive, send)
2024-09-18T08:21:01.377094673Z File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
2024-09-18T08:21:01.377099623Z raise exc
2024-09-18T08:21:01.377104181Z File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
2024-09-18T08:21:01.377109373Z await self.app(scope, receive, _send)
2024-09-18T08:21:01.377113787Z File "/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line 24, in __call__
2024-09-18T08:21:01.377118448Z await responder(scope, receive, send)
2024-09-18T08:21:01.377123325Z File "/usr/local/lib/python3.12/site-packages/starlette/middleware/gzip.py", line 44, in __call__
2024-09-18T08:21:01.377128315Z await self.app(scope, receive, self.send_with_gzip)
2024-09-18T08:21:01.377133617Z File "/usr/local/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
2024-09-18T08:21:01.377138569Z await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-09-18T08:21:01.377144296Z File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-09-18T08:21:01.377149265Z raise exc
2024-09-18T08:21:01.377154009Z File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-09-18T08:21:01.377159153Z await app(scope, receive, sender)
2024-09-18T08:21:01.377164071Z File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 754, in __call__
2024-09-18T08:21:01.377176070Z await self.middleware_stack(scope, receive, send)
2024-09-18T08:21:01.377181279Z File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 774, in app
2024-09-18T08:21:01.377186165Z await route.handle(scope, receive, send)
2024-09-18T08:21:01.377202625Z File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 295, in handle
2024-09-18T08:21:01.377208121Z await self.app(scope, receive, send)
2024-09-18T08:21:01.377212745Z File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
2024-09-18T08:21:01.377217686Z await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-09-18T08:21:01.377222536Z File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-09-18T08:21:01.377228063Z raise exc
2024-09-18T08:21:01.377232931Z File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-09-18T08:21:01.377238140Z await app(scope, receive, sender)
2024-09-18T08:21:01.377243173Z File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 74, in app
2024-09-18T08:21:01.377248315Z response = await f(request)
2024-09-18T08:21:01.377253154Z ^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377257898Z File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
2024-09-18T08:21:01.377262942Z raw_response = await run_endpoint_function(
2024-09-18T08:21:01.377268331Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377273110Z File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-09-18T08:21:01.377277989Z return await dependant.call(**values)
2024-09-18T08:21:01.377282434Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377287107Z File "/app/src/api/routers/collections.py", line 39, in get_collections
2024-09-18T08:21:01.377292269Z collections = await crud.get_collections(
2024-09-18T08:21:01.377297275Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377302179Z File "/app/src/api/database/crud.py", line 212, in get_collections
2024-09-18T08:21:01.377307480Z results = await session.exec(query)
2024-09-18T08:21:01.377312599Z ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377317241Z File "/usr/local/lib/python3.12/site-packages/sqlmodel/ext/asyncio/session.py", line 81, in exec
2024-09-18T08:21:01.377324770Z result = await greenlet_spawn(
2024-09-18T08:21:01.377329314Z ^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377333735Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 203, in greenlet_spawn
2024-09-18T08:21:01.377347108Z result = context.switch(value)
2024-09-18T08:21:01.377351973Z ^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377357170Z File "/usr/local/lib/python3.12/site-packages/sqlmodel/orm/session.py", line 66, in exec
2024-09-18T08:21:01.377362153Z results = super().execute(
2024-09-18T08:21:01.377366973Z ^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377378523Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2362, in execute
2024-09-18T08:21:01.377384142Z return self._execute_internal(
2024-09-18T08:21:01.377389149Z ^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377394164Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2247, in _execute_internal
2024-09-18T08:21:01.377399010Z result: Result[Any] = compile_state_cls.orm_execute_statement(
2024-09-18T08:21:01.377403822Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377408550Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
2024-09-18T08:21:01.377413706Z result = conn.execute(
2024-09-18T08:21:01.377418280Z ^^^^^^^^^^^^^
2024-09-18T08:21:01.377422693Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
2024-09-18T08:21:01.377427989Z return meth(
2024-09-18T08:21:01.377432973Z ^^^^^
2024-09-18T08:21:01.377438155Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
2024-09-18T08:21:01.377443663Z return connection._execute_clauseelement(
2024-09-18T08:21:01.377448957Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377453900Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
2024-09-18T08:21:01.377458947Z ret = self._execute_context(
2024-09-18T08:21:01.377463965Z ^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377468391Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
2024-09-18T08:21:01.377473713Z return self._exec_single_context(
2024-09-18T08:21:01.377478856Z ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377483560Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
2024-09-18T08:21:01.377488600Z self._handle_dbapi_exception(
2024-09-18T08:21:01.377493226Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
2024-09-18T08:21:01.377498014Z raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
2024-09-18T08:21:01.377504356Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
2024-09-18T08:21:01.377528678Z self.dialect.do_execute(
2024-09-18T08:21:01.377534135Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
2024-09-18T08:21:01.377539437Z cursor.execute(statement, parameters)
2024-09-18T08:21:01.377544472Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 572, in execute
2024-09-18T08:21:01.377549558Z self._adapt_connection.await_(
2024-09-18T08:21:01.377554363Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only
2024-09-18T08:21:01.377559187Z return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501
2024-09-18T08:21:01.377564078Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-18T08:21:01.377568759Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn
2024-09-18T08:21:01.377574667Z value = await result
2024-09-18T08:21:01.377579555Z ^^^^^^^^^^^^
2024-09-18T08:21:01.377584098Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 508, in _prepare_and_execute
2024-09-18T08:21:01.377589121Z await adapt_connection._start_transaction()
2024-09-18T08:21:01.377594099Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 837, in _start_transaction
2024-09-18T08:21:01.377599220Z self._handle_exception(error)
2024-09-18T08:21:01.377603903Z File "/usr/local/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 784, in _handle_exception
2024-09-18T08:21:01.377608716Z raise translated_error from error
2024-09-18T08:21:01.377613800Z sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.ConnectionDoesNotExistError'>: connection was closed in the middle of operation
2024-09-18T08:21:01.377619460Z [SQL: SELECT collection.collection_id, collection.data_version, collection.collected_at, collection.duration, collection.fleet_count, collection.user_count, collection.tournament_running, collection.max_tournament_battle_attempts
2024-09-18T08:21:01.377624866Z FROM collection
2024-09-18T08:21:01.377629536Z WHERE EXTRACT(month FROM collection.collected_at) != EXTRACT(month FROM collection.collected_at + $1::INTERVAL) ORDER BY collection.collected_at ASC
2024-09-18T08:21:01.377634389Z LIMIT $2::INTEGER OFFSET $3::INTEGER]
2024-09-18T08:21:01.377639256Z [parameters: (datetime.timedelta(seconds=3600), 1, 0)]
2024-09-18T08:21:01.377644307Z (Background on this error at: https://sqlalche.me/e/20/dbapi)
Zukunftsmusik commented 3 days ago

Probably fixed with v1.5.2