#34389: Django not closing database connections on ASGI application after an
upgrade to 4.1
-----------------------------------------+------------------------
Reporter: vsobotka | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
We just upgraded Django from version 2.2.12 to version 4.1.7. We are using
a basic ASGI app config
{{{
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Landia.settings")
django.setup()
application = get_default_application()
}}}
We are on Heroku, with Heroku Postgres version 12.14, and we use
psycopg2-binary version 2.9.5. We also use Gunicorn 20.1.0, and Uvicorn
0.20.0.
Database is connected
{{{
DATABASES['default'] = dj_database_url.config(conn_max_age=0)
}}}
Since we deployed to production, we have started to experience a database
connection buildup, quickly using up the whole pool of connection allowed
by Postgres. A few minutes after the deploy we only get exception about no
available connections.
We tried upgrading Django to 4.2b1, and Psycopg 3, but the issue still
persisted. Now we tried downgrading Django to 3.1.8, and the connections
are at their usual level, not being used up at all, with everything else
but Django on a different version. This leads me to believe Django is not
closing connections, but it could be due to an issue with our setup.
I would greatly appreciate any help regarding this issue, as this is a
production blocker for us, at least for 4.1.
--
Ticket URL: <https://code.djangoproject.com/ticket/34389>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070186b633418e-0e50c4da-bc35-482f-b760-72894d8c65e8-000000%40eu-central-1.amazonses.com.