#24810: Reopen database connection automatically when no transaction is active
-------------------------------------+-------------------------------------
Reporter: aaugustin | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by akaariai):
It must be noted that SQL connections can have state even when not in a
transaction. These could be for example session variables, per-connection
configuration (SET search_path = xxx), temporary tables etc. While Django
doesn't use any of these directly, breaking Django for users who do use
connection state should be avoided.
If we are going to reopen connections automatically we need some safe-
guards against above problems. As we can't detect automatically when users
have session state in their connections, the users should tell us about
this. I think opt-out (or maybe opt-in?) flag in the connection's settings
could work. Something like set `OPTIONS['stateful_connection'] = True`,
and Django will not try to reopen failed connections.
Other than the above remark I don't see a problem with this approach.
Still, without further evidence that these kinds of failures are common, I
believe this will require too much complexity compared to what is gained.
--
Ticket URL: <https://code.djangoproject.com/ticket/24810#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.57457ee0875981eaf2e5f9fd9055fd8e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.