Hi!
Exact same issues here, and some other related:
InterfaceError: connection already closed
TransactionManagementError An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
InterfaceError: cursor already closed
'NoneType' object has no attribute 'cursor'
My setup:
- Django 4.1.1
- Gunicorn 20.1.0 (and then 21.2.0)
- psycopg2-binary 2.9.3
- Postgres 14.9 ? (managed)
The 2 non-django native middlewares that I use amongst those mentionned by @lukas-slezevicius are whitenoise (6.5.0) and debug_toolbar (3.6.0).
I am also using a postgres managed database instead of hosting it locally. I suspected the service provider to be the cause but looking at the thread I’m not really sure anymore.
Since we all got the same gunicorn version I tried upgrading but still same issues.