Originally created by @zkutasi on GitHub (Nov 28, 2025).
Right after deployment, everything works fine...
But I have left the tool idle for a day and returned to it the next day.
Now I have a working UI but any DB transaction goes like this in the logs:
django.db.utils.OperationalError: the connection is closed
I then delete the Pod (mind you I am deploying on Kubernetes), and everything works again.
Originally created by @zkutasi on GitHub (Nov 28, 2025).
Right after deployment, everything works fine...
But I have left the tool idle for a day and returned to it the next day.
Now I have a working UI but any DB transaction goes like this in the logs:
```
django.db.utils.OperationalError: the connection is closed
```
I then delete the Pod (mind you I am deploying on Kubernetes), and everything works again.
adam
added the bug label 2025-12-28 23:25:16 +01:00
But I haven't seen it happen on the normal Django thread, specially in such a short time. If this happens again, let me know.
@eitchtee commented on GitHub (Nov 28, 2025):
I suppose you don't have the logs for this anymore, but was this blocking normal UI behavior, like adding new transactions?
I've seen this happen with the background tasks, but it seems to be random, it should be related to https://github.com/procrastinate-org/procrastinate/issues/1134. Usually restarting the dabatase and application fixes the issue.
But I haven't seen it happen on the normal Django thread, specially in such a short time. If this happens again, let me know.
Yes, this blocks nearly everything that requires modification in the DB... and those are silently dropped... like... I wanted to try your idea how to trigger Rules on an already loaded transaction (trigger on update + unpaid/paid switch), and for 1 hour it did not work, then I remembered this other issue I had, so I recreated the Pod, and voila.
This is the log I have:
[2025-11-28 09:27:14] - INFO - procrastinate.worker.worker - Starting job check_for_transaction_rules[1139](signal='transaction_created', user_id=1, old_data=None, instance_id=1025)
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Starting rule execution...
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Available functions: dict_keys(['relativedelta', 'str', 'int', 'float', 'abs', 'randint', 'random', 'decimal', 'datetime', 'date', 'transactions'])
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Testing 0 rule(s)...
[2025-11-28 09:27:14] - INFO - procrastinate.worker - Job check_for_transaction_rules[1139](signal='transaction_created', user_id=1, old_data=None, instance_id=1025) ended with status: Success, lasted 0.020 s - Result: (None, [])
[2025-11-28 09:27:14] - INFO - procrastinate.worker.worker - Starting job check_for_transaction_rules[1140](signal='transaction_created', user_id=1, old_data=None, instance_id=1026)
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Starting rule execution...
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Available functions: dict_keys(['relativedelta', 'str', 'int', 'float', 'abs', 'randint', 'random', 'decimal', 'datetime', 'date', 'transactions'])
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Testing 0 rule(s)...
[2025-11-28 09:27:14] - INFO - procrastinate.worker - Job check_for_transaction_rules[1140](signal='transaction_created', user_id=1, old_data=None, instance_id=1026) ended with status: Success, lasted 0.020 s - Result: (None, [])
[2025-11-28 09:27:14] - INFO - procrastinate.worker.worker - Starting job check_for_transaction_rules[1141](signal='transaction_created', user_id=1, old_data=None, instance_id=1027)
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Starting rule execution...
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Available functions: dict_keys(['relativedelta', 'str', 'int', 'float', 'abs', 'randint', 'random', 'decimal', 'datetime', 'date', 'transactions'])
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Testing 0 rule(s)...
[2025-11-28 09:27:14] - INFO - procrastinate.worker - Job check_for_transaction_rules[1141](signal='transaction_created', user_id=1, old_data=None, instance_id=1027) ended with status: Success, lasted 0.024 s - Result: (None, [])
[2025-11-28 10:00:00] - INFO - procrastinate.periodic - Periodic job automatic_fetch_exchange_rates[1142](timestamp=1764320400) deferred for timestamp 1764320400 with id 1142
[2025-11-28 10:00:00] - INFO - procrastinate.worker.worker - Starting job automatic_fetch_exchange_rates[1142](timestamp=1764320400)
[2025-11-28 10:00:00] - ERROR - apps.currencies.tasks - consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
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/src/app/apps/currencies/tasks.py", line 17, in automatic_fetch_exchange_rates
fetcher.fetch_due_rates()
File "/usr/src/app/apps/currencies/exchange_rates/fetcher.py", line 104, in fetch_due_rates
for service in services:
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 386, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
[2025-11-28 10:00:00] - INFO - procrastinate.worker - Job automatic_fetch_exchange_rates[1142](timestamp=1764320400) ended with status: Success, lasted 0.006 s
[2025-11-28 11:00:00] - INFO - procrastinate.periodic - Periodic job automatic_fetch_exchange_rates[1143](timestamp=1764324000) deferred for timestamp 1764324000 with id 1143
[2025-11-28 11:00:00] - INFO - procrastinate.worker.worker - Starting job automatic_fetch_exchange_rates[1143](timestamp=1764324000)
[2025-11-28 11:00:00] - ERROR - apps.currencies.tasks - consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
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/src/app/apps/currencies/tasks.py", line 17, in automatic_fetch_exchange_rates
fetcher.fetch_due_rates()
File "/usr/src/app/apps/currencies/exchange_rates/fetcher.py", line 104, in fetch_due_rates
for service in services:
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 386, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
[2025-11-28 11:00:00] - INFO - procrastinate.worker - Job automatic_fetch_exchange_rates[1143](timestamp=1764324000) ended with status: Success, lasted 0.004 s
[2025-11-28 12:00:00] - INFO - procrastinate.periodic - Periodic job automatic_fetch_exchange_rates[1144](timestamp=1764327600) deferred for timestamp 1764327600 with id 1144
[2025-11-28 12:00:00] - INFO - procrastinate.worker.worker - Starting job automatic_fetch_exchange_rates[1144](timestamp=1764327600)
[2025-11-28 12:00:00] - ERROR - apps.currencies.tasks - the connection is closed
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
psycopg.OperationalError: the connection is closed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/app/apps/currencies/tasks.py", line 17, in automatic_fetch_exchange_rates
fetcher.fetch_due_rates()
File "/usr/src/app/apps/currencies/exchange_rates/fetcher.py", line 104, in fetch_due_rates
for service in services:
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 386, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1621, in execute_sql
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 320, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 297, in _cursor
with self.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
django.db.utils.OperationalError: the connection is closed
And for a few dozen times, the last error, until I restarted the Pod.
Like this one is the last occurrence:
[2025-11-29 16:43:00] - ERROR - procrastinate.worker - Job check_for_transaction_rules[1208](signal='transaction_updated', user_id=1, old_data={'id': 369, 'date': '2025-11-26', 'mute': False, 'tags': [], 'type': 'EX', 'notes': '', 'amount': '8738.000000000000000000000000000000', 'account': [2, 'KUTASI ZOLTÁN'], 'deleted': False, 'is_paid': False, 'category': [None, None], 'entities': [], 'is_asset': False, 'description': '00061860 BUDAPEST TESCO 41640 O:NKISZOLGi', 'installment': False, 'internal_id': None, 'is_archived': False, 'account_group': [None, None], 'internal_note': '', 'installment_id': None, 'reference_date': '2025-11-01', 'installment_total': None, 'recurring_transaction': False}, instance_id=369) ended with status: Error, lasted 0.006 s
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
psycopg.OperationalError: the connection is closed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/procrastinate/worker.py", line 266, in _process_job
job_result.result = await ensure_async()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/procrastinate/worker.py", line 252, in ensure_async
task_result = await await_func(*job_args, **job.task_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/procrastinate/utils.py", line 109, in sync_to_async
return await sync.sync_to_async(func, thread_sensitive=False)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/asgiref/sync.py", line 504, in __call__
ret = await asyncio.shield(exec_coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/asgiref/sync.py", line 559, in thread_handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/rules/tasks.py", line 767, in check_for_transaction_rules
raise e
File "/usr/src/app/apps/rules/tasks.py", line 558, in check_for_transaction_rules
instance = Transaction.objects.get(id=instance_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 88, in inner
return execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1621, in execute_sql
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 320, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 297, in _cursor
with self.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
django.db.utils.OperationalError: the connection is closed
@zkutasi commented on GitHub (Nov 29, 2025):
Yes, this blocks nearly everything that requires modification in the DB... and those are silently dropped... like... I wanted to try your idea how to trigger Rules on an already loaded transaction (trigger on update + unpaid/paid switch), and for 1 hour it did not work, then I remembered this other issue I had, so I recreated the Pod, and voila.
This is the log I have:
```
[2025-11-28 09:27:14] - INFO - procrastinate.worker.worker - Starting job check_for_transaction_rules[1139](signal='transaction_created', user_id=1, old_data=None, instance_id=1025)
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Starting rule execution...
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Available functions: dict_keys(['relativedelta', 'str', 'int', 'float', 'abs', 'randint', 'random', 'decimal', 'datetime', 'date', 'transactions'])
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Testing 0 rule(s)...
[2025-11-28 09:27:14] - INFO - procrastinate.worker - Job check_for_transaction_rules[1139](signal='transaction_created', user_id=1, old_data=None, instance_id=1025) ended with status: Success, lasted 0.020 s - Result: (None, [])
[2025-11-28 09:27:14] - INFO - procrastinate.worker.worker - Starting job check_for_transaction_rules[1140](signal='transaction_created', user_id=1, old_data=None, instance_id=1026)
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Starting rule execution...
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Available functions: dict_keys(['relativedelta', 'str', 'int', 'float', 'abs', 'randint', 'random', 'decimal', 'datetime', 'date', 'transactions'])
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Testing 0 rule(s)...
[2025-11-28 09:27:14] - INFO - procrastinate.worker - Job check_for_transaction_rules[1140](signal='transaction_created', user_id=1, old_data=None, instance_id=1026) ended with status: Success, lasted 0.020 s - Result: (None, [])
[2025-11-28 09:27:14] - INFO - procrastinate.worker.worker - Starting job check_for_transaction_rules[1141](signal='transaction_created', user_id=1, old_data=None, instance_id=1027)
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Starting rule execution...
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Available functions: dict_keys(['relativedelta', 'str', 'int', 'float', 'abs', 'randint', 'random', 'decimal', 'datetime', 'date', 'transactions'])
[2025-11-28 09:27:14] - INFO - apps.rules.tasks - Testing 0 rule(s)...
[2025-11-28 09:27:14] - INFO - procrastinate.worker - Job check_for_transaction_rules[1141](signal='transaction_created', user_id=1, old_data=None, instance_id=1027) ended with status: Success, lasted 0.024 s - Result: (None, [])
[2025-11-28 10:00:00] - INFO - procrastinate.periodic - Periodic job automatic_fetch_exchange_rates[1142](timestamp=1764320400) deferred for timestamp 1764320400 with id 1142
[2025-11-28 10:00:00] - INFO - procrastinate.worker.worker - Starting job automatic_fetch_exchange_rates[1142](timestamp=1764320400)
[2025-11-28 10:00:00] - ERROR - apps.currencies.tasks - consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
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/src/app/apps/currencies/tasks.py", line 17, in automatic_fetch_exchange_rates
fetcher.fetch_due_rates()
File "/usr/src/app/apps/currencies/exchange_rates/fetcher.py", line 104, in fetch_due_rates
for service in services:
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 386, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
[2025-11-28 10:00:00] - INFO - procrastinate.worker - Job automatic_fetch_exchange_rates[1142](timestamp=1764320400) ended with status: Success, lasted 0.006 s
[2025-11-28 11:00:00] - INFO - procrastinate.periodic - Periodic job automatic_fetch_exchange_rates[1143](timestamp=1764324000) deferred for timestamp 1764324000 with id 1143
[2025-11-28 11:00:00] - INFO - procrastinate.worker.worker - Starting job automatic_fetch_exchange_rates[1143](timestamp=1764324000)
[2025-11-28 11:00:00] - ERROR - apps.currencies.tasks - consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
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/src/app/apps/currencies/tasks.py", line 17, in automatic_fetch_exchange_rates
fetcher.fetch_due_rates()
File "/usr/src/app/apps/currencies/exchange_rates/fetcher.py", line 104, in fetch_due_rates
for service in services:
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 386, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
[2025-11-28 11:00:00] - INFO - procrastinate.worker - Job automatic_fetch_exchange_rates[1143](timestamp=1764324000) ended with status: Success, lasted 0.004 s
[2025-11-28 12:00:00] - INFO - procrastinate.periodic - Periodic job automatic_fetch_exchange_rates[1144](timestamp=1764327600) deferred for timestamp 1764327600 with id 1144
[2025-11-28 12:00:00] - INFO - procrastinate.worker.worker - Starting job automatic_fetch_exchange_rates[1144](timestamp=1764327600)
[2025-11-28 12:00:00] - ERROR - apps.currencies.tasks - the connection is closed
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
psycopg.OperationalError: the connection is closed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/app/apps/currencies/tasks.py", line 17, in automatic_fetch_exchange_rates
fetcher.fetch_due_rates()
File "/usr/src/app/apps/currencies/exchange_rates/fetcher.py", line 104, in fetch_due_rates
for service in services:
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 386, in __iter__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1621, in execute_sql
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 320, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 297, in _cursor
with self.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
django.db.utils.OperationalError: the connection is closed
```
And for a few dozen times, the last error, until I restarted the Pod.
Like this one is the last occurrence:
```
[2025-11-29 16:43:00] - ERROR - procrastinate.worker - Job check_for_transaction_rules[1208](signal='transaction_updated', user_id=1, old_data={'id': 369, 'date': '2025-11-26', 'mute': False, 'tags': [], 'type': 'EX', 'notes': '', 'amount': '8738.000000000000000000000000000000', 'account': [2, 'KUTASI ZOLTÁN'], 'deleted': False, 'is_paid': False, 'category': [None, None], 'entities': [], 'is_asset': False, 'description': '00061860 BUDAPEST TESCO 41640 O:NKISZOLGi', 'installment': False, 'internal_id': None, 'is_archived': False, 'account_group': [None, None], 'internal_note': '', 'installment_id': None, 'reference_date': '2025-11-01', 'installment_total': None, 'recurring_transaction': False}, instance_id=369) ended with status: Error, lasted 0.006 s
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
psycopg.OperationalError: the connection is closed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/procrastinate/worker.py", line 266, in _process_job
job_result.result = await ensure_async()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/procrastinate/worker.py", line 252, in ensure_async
task_result = await await_func(*job_args, **job.task_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/procrastinate/utils.py", line 109, in sync_to_async
return await sync.sync_to_async(func, thread_sensitive=False)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/asgiref/sync.py", line 504, in __call__
ret = await asyncio.shield(exec_coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/asgiref/sync.py", line 559, in thread_handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/rules/tasks.py", line 767, in check_for_transaction_rules
raise e
File "/usr/src/app/apps/rules/tasks.py", line 558, in check_for_transaction_rules
instance = Transaction.objects.get(id=instance_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 88, in inner
return execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1621, in execute_sql
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 320, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 297, in _cursor
with self.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/base/base.py", line 298, in _cursor
return self._prepare_cursor(self.create_cursor(name))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/postgresql/base.py", line 429, in create_cursor
cursor = self.connection.cursor()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/connection.py", line 219, in cursor
self._check_connection_ok()
File "/usr/local/lib/python3.11/site-packages/psycopg/_connection_base.py", line 527, in _check_connection_ok
raise e.OperationalError("the connection is closed")
django.db.utils.OperationalError: the connection is closed
```
Next release will have a possible patch for this (possible because I can't reliably test this). I've closed the issue, but let me know if you still encounter this problem in the future.
@eitchtee commented on GitHub (Dec 6, 2025):
Next release will have a possible patch for this (possible because I can't reliably test this). I've closed the issue, but let me know if you still encounter this problem in the future.
Unfortunately it came again with 0.18.1, in this flavor:
[2025-12-19 13:36:48] - ERROR - django.request - Internal Server Error: /exchange-rates/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:48] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18aa44910>
[2025-12-19 13:36:53] - ERROR - django.request - Internal Server Error: /insights/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:53] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18a8455d0>
[2025-12-19 13:36:54] - ERROR - django.request - Internal Server Error: /favicon.ico
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:54] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18a875fd0>
[2025-12-19 13:36:54] - ERROR - django.request - Internal Server Error: /serviceworker.js
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:54] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18a845350>
I got a Server 500 when I wanted to click on anything... so I deleted my Pod and now it works again.
Maybe a workaround might be to constantly use the DB connection? I am trying to figure out how, maybe by doing an automatic exchange rate checker.
@zkutasi commented on GitHub (Dec 19, 2025):
Thanks!
Unfortunately it came again with 0.18.1, in this flavor:
```
[2025-12-19 13:36:48] - ERROR - django.request - Internal Server Error: /exchange-rates/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:48] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18aa44910>
[2025-12-19 13:36:53] - ERROR - django.request - Internal Server Error: /insights/
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:53] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18a8455d0>
[2025-12-19 13:36:54] - ERROR - django.request - Internal Server Error: /favicon.ico
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:54] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18a875fd0>
[2025-12-19 13:36:54] - ERROR - django.request - Internal Server Error: /serviceworker.js
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 244, in _get_session
return self._session_cache
^^^^^^^^^^^^^^^^^^^
AttributeError: 'SessionStore' object has no attribute '_session_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
psycopg.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/apps/common/middleware/localization.py", line 18, in __call__
if request.user.is_authenticated and hasattr(request.user, "settings"):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 251, in inner
self._setup()
File "/usr/local/lib/python3.11/site-packages/django/utils/functional.py", line 404, in _setup
self._wrapped = self._setupfunc()
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 40, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/middleware.py", line 20, in get_user
request._cached_user = auth.get_user(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 304, in get_user
user_id = _get_user_session_key(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/__init__.py", line 95, in _get_user_session_key
return get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 55, in __getitem__
return self._session[key]
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/base.py", line 249, in _get_session
self._session_cache = self.load()
^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 55, in load
s = self._get_session_from_db()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/contrib/sessions/backends/db.py", line 34, in _get_session_from_db
return self.model.objects.get(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 631, in get
num = len(clone)
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 368, in __len__
self._fetch_all()
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 1954, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 93, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 38, in inner
return original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 101, in inner
return _get_result_or_execute_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 65, in _get_result_or_execute_query
result = execute_query_func()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 85, in <lambda>
execute_query_func = lambda: original(compiler, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1623, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.11/site-packages/cachalot/monkey_patch.py", line 142, in inner
return original(cursor, sql, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/psycopg/cursor.py", line 97, in execute
raise ex.with_traceback(None)
django.db.utils.OperationalError: consuming input failed: SSL SYSCALL error: EOF detected
[2025-12-19 13:36:54] - WARNING - psycopg.pool - discarding closed connection: <psycopg.Connection [BAD] at 0x74e18a845350>
```
I got a Server 500 when I wanted to click on anything... so I deleted my Pod and now it works again.
Maybe a workaround might be to constantly use the DB connection? I am trying to figure out how, maybe by doing an automatic exchange rate checker.
Very sorry about this. Not sure why you're the lucky one facing these issues.
Are you using a brand new postgres instance (e.g. the one provided in the docker-compose) or connecting to an existing instance? Maybe your postgres instance is very eager to close existing connections due to some configuration or lack of resources?
Either way I will release a different fix for this, fingers crossed it works this time.
Django has a built-in health check option, meaning it pings the database before using the connection, if it's dead it will create a new connection (which is somewhat similar to your suggestion). My fear about using this was performance, but there's no mention of it in the documentation, so I'm trusting it's fine.
@eitchtee commented on GitHub (Dec 20, 2025):
Very sorry about this. Not sure why you're the lucky one facing these issues.
Are you using a brand new postgres instance (e.g. the one provided in the docker-compose) or connecting to an existing instance? Maybe your postgres instance is very eager to close existing connections due to some configuration or lack of resources?
Either way I will release a different fix for this, fingers crossed it works this time.
Django has a built-in health check option, meaning it pings the database before using the connection, if it's dead it will create a new connection (which is somewhat similar to your suggestion). My fear about using this was performance, but there's no mention of it in the documentation, so I'm trusting it's fine.
I am using Kubernetes, so I took your provided docker-compose, and use TrueCharts' library chart to generate a workload for me, with Cloud Native Postgres (CNPG). It may very well be that the default config in CNPG is not suitable for your app... but I am selfhosting a lot of things due to try-and-see and never encountered such issues before with others (though your stack might be unique of course).
I have tried to do an automatic exchange conversion to perhaps keep the DB open, but the default 24 hours still gave me the 500 error. Mind you, this error is very visible now, as it crashes the app itself for me, so no problem finding it out now :). I now set the interval to 4 hours, I wonder if this would help.
Another workaround I think would be worth it is to implement a health-check on kubernetes Pod level, so the system could restart the container itself when this happens.
@zkutasi commented on GitHub (Dec 20, 2025):
I am using Kubernetes, so I took your provided docker-compose, and use TrueCharts' library chart to generate a workload for me, with Cloud Native Postgres (CNPG). It may very well be that the default config in CNPG is not suitable for your app... but I am selfhosting a lot of things due to try-and-see and never encountered such issues before with others (though your stack might be unique of course).
I have tried to do an automatic exchange conversion to perhaps keep the DB open, but the default 24 hours still gave me the 500 error. Mind you, this error is very visible now, as it crashes the app itself for me, so no problem finding it out now :). I now set the interval to 4 hours, I wonder if this would help.
Another workaround I think would be worth it is to implement a health-check on kubernetes Pod level, so the system could restart the container itself when this happens.
I have 0 experience with k8s, so I might not be very helpful in this instance. 0.18.3 will be released tomorrow, it implements the health-checks for database connections which I think has a lot of potential in fixing this, let me know how it goes.
Feel free to re-open this issue if you encounter problems again.
@max-wittig seems to have had some relative success recently with his k8s instance, maybe he could give out some tips or his configuration.
@eitchtee commented on GitHub (Dec 20, 2025):
I have 0 experience with k8s, so I might not be very helpful in this instance. 0.18.3 will be released tomorrow, it implements the health-checks for database connections which I think has a lot of potential in fixing this, let me know how it goes.
Feel free to re-open this issue if you encounter problems again.
@max-wittig seems to have had some relative success recently with his k8s instance, maybe he could give out some tips or his configuration.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @zkutasi on GitHub (Nov 28, 2025).
Right after deployment, everything works fine...
But I have left the tool idle for a day and returned to it the next day.
Now I have a working UI but any DB transaction goes like this in the logs:
I then delete the Pod (mind you I am deploying on Kubernetes), and everything works again.
@eitchtee commented on GitHub (Nov 28, 2025):
I suppose you don't have the logs for this anymore, but was this blocking normal UI behavior, like adding new transactions?
I've seen this happen with the background tasks, but it seems to be random, it should be related to https://github.com/procrastinate-org/procrastinate/issues/1134. Usually restarting the dabatase and application fixes the issue.
But I haven't seen it happen on the normal Django thread, specially in such a short time. If this happens again, let me know.
@zkutasi commented on GitHub (Nov 29, 2025):
Yes, this blocks nearly everything that requires modification in the DB... and those are silently dropped... like... I wanted to try your idea how to trigger Rules on an already loaded transaction (trigger on update + unpaid/paid switch), and for 1 hour it did not work, then I remembered this other issue I had, so I recreated the Pod, and voila.
This is the log I have:
And for a few dozen times, the last error, until I restarted the Pod.
Like this one is the last occurrence:
@eitchtee commented on GitHub (Dec 6, 2025):
Next release will have a possible patch for this (possible because I can't reliably test this). I've closed the issue, but let me know if you still encounter this problem in the future.
@zkutasi commented on GitHub (Dec 19, 2025):
Thanks!
Unfortunately it came again with 0.18.1, in this flavor:
I got a Server 500 when I wanted to click on anything... so I deleted my Pod and now it works again.
Maybe a workaround might be to constantly use the DB connection? I am trying to figure out how, maybe by doing an automatic exchange rate checker.
@eitchtee commented on GitHub (Dec 20, 2025):
Very sorry about this. Not sure why you're the lucky one facing these issues.
Are you using a brand new postgres instance (e.g. the one provided in the docker-compose) or connecting to an existing instance? Maybe your postgres instance is very eager to close existing connections due to some configuration or lack of resources?
Either way I will release a different fix for this, fingers crossed it works this time.
Django has a built-in health check option, meaning it pings the database before using the connection, if it's dead it will create a new connection (which is somewhat similar to your suggestion). My fear about using this was performance, but there's no mention of it in the documentation, so I'm trusting it's fine.
@eitchtee commented on GitHub (Dec 20, 2025):
I will try to release this fix this Sunday, please let me know if you still have problems.
@zkutasi commented on GitHub (Dec 20, 2025):
I am using Kubernetes, so I took your provided docker-compose, and use TrueCharts' library chart to generate a workload for me, with Cloud Native Postgres (CNPG). It may very well be that the default config in CNPG is not suitable for your app... but I am selfhosting a lot of things due to try-and-see and never encountered such issues before with others (though your stack might be unique of course).
I have tried to do an automatic exchange conversion to perhaps keep the DB open, but the default 24 hours still gave me the 500 error. Mind you, this error is very visible now, as it crashes the app itself for me, so no problem finding it out now :). I now set the interval to 4 hours, I wonder if this would help.
Another workaround I think would be worth it is to implement a health-check on kubernetes Pod level, so the system could restart the container itself when this happens.
@eitchtee commented on GitHub (Dec 20, 2025):
I have 0 experience with k8s, so I might not be very helpful in this instance. 0.18.3 will be released tomorrow, it implements the health-checks for database connections which I think has a lot of potential in fixing this, let me know how it goes.
Feel free to re-open this issue if you encounter problems again.
@max-wittig seems to have had some relative success recently with his k8s instance, maybe he could give out some tips or his configuration.