You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From time to time, my postgres database is cluttered with idle connections, and it can lead to new connections failures, which make my application unavailable.
So my solution was to setup idle_session_timeout and idle_in_transaction_session_timeout to 15min on my database, which should be OK because Django is configured with CONN_MAX_AGE = 600 (10min).
But now my worker, which runs with --pool gevent, has failures from time to time, and the stack trace shows
My understanding is that the connection has been closed by the database before the application has closed it. My investigation showed me that Django manages the connection life-cycle with 2 signals
I have done some more research, and it seems the issue is deeper with gevent workers / web workers.
There might be improvements to see with Django 5.1 use of psycopg pool, but for now i will try to switch to persistent connection and remove the cleanup of idle sessions from my postgres database.
From time to time, my postgres database is cluttered with idle connections, and it can lead to new connections failures, which make my application unavailable.
So my solution was to setup
idle_session_timeout
andidle_in_transaction_session_timeout
to 15min on my database, which should be OK because Django is configured withCONN_MAX_AGE = 600
(10min).But now my worker, which runs with
--pool gevent
, has failures from time to time, and the stack trace showsMy understanding is that the connection has been closed by the database before the application has closed it. My investigation showed me that Django manages the connection life-cycle with 2 signals
But I couldn't find such a mechanism in Django Celery Results. So my questions:
CONN_MAX_AGE
work?The text was updated successfully, but these errors were encountered: