[Triage] Error 500 on ASGI Worker with psycopg-pool #3636
Replies: 1 comment
SUMMARYThe bug is a regression introduced in Gunicorn 25.2.0, not fully resolved OBSERVATIONS (from MRE)Gunicorn 25.1.0 + asgi worker + pool -> WORKS ROOT CAUSE (likely)Gunicorn's built-in ASGI worker does not fully respect the async lifecycle The underlying fix would need to happen in how Gunicorn's ASGI worker WORKAROUNDSOPTION 1 — Switch to the uvicorn worker (recommended)Your own MRE confirms this works. The uvicorn worker is also the gunicorn asgi:application Install uvicorn if needed: OPTION 2 — Disable the psycopg pool temporarilyIn your Django DATABASES settings, remove the pool option: DATABASES = { This falls back to per-request connections. Not ideal for performance, OPTION 3 — Pin to Gunicorn 25.1.0The last known-good version before the regression: pip install gunicorn==25.1.0 Not a long-term fix, but useful to confirm the regression and keep REFERENCES
|
Uh oh!
There was an error while loading. Please reload this page.
Type
Bug Report
Description
After a couple requests, a django application running under ASGI Worker becomes unable to reuse the postgres connection pool.
Steps to Reproduce (for bugs)
Write down a minimal Django application using pyscopg-pool and run it under gunicorn's ASGI Worker.
I wrote down a MRE for this problem.
Configuration
Logs / Error Output
No response
Gunicorn Version
gunicorn 26.0.0
Python Version
Python 3.14.5
Worker Class
asgi (beta)
Operating System
MacOS
Additional Context
No response
Checklist
All reactions