#33497: Database persistent connections do not work with ASGI in 4.0
-------------------------------------+-------------------------------------
Reporter: Stenkar | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: ASGI, Database, | Triage Stage: Accepted
async |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by joeli):
Replying to [comment:12 Patryk Zawadzki]:
> This is marked as a "new feature," but it's an undocumented breaking
change between 3.2 and 4.0. Connections that were previously reused and
terminated are now just left to linger.
>
> The {{{request_finished}}} signal does not terminate them as they are
not idle for longer than {{{MAX_CONN_AGE}}}.
>
> The {{{request_started}}} signal does not terminate them as it never
sees those connections due to the connection state being
{{{asgiref.local}}} and discarded after every request.
>
> Allowing parallel execution of requests is a great change, but I feel
Django should outright refuse to start if {{{MAX_CONN_AGE}}} is combined
with ASGI.
I agree. I would even go as far as calling this a regression, not just an
undocumented breaking change. No matter the reasons behind it or the
technical superiority of the new solution, fact of the matter stands that
in 3.2 ASGI mode our code worked fine and reused connections. In 4.x it is
broken unless using {{{MAX_CONN_AGE = 0}}}, which disables a feature in
Django that used to work.
--
Ticket URL: <https://code.djangoproject.com/ticket/33497#comment:15>
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/01070184bd1feafd-5d9c26ab-a535-4737-9d4e-e7cfd0e43906-000000%40eu-central-1.amazonses.com.