Opened 11 years ago

Closed 11 years ago

#12452 closed (fixed)

Not all database connections are being closed (multidb)

Reported by: samuel@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Now with multidb there can be multiple connections to different databases. Only the default one is being closed at the end of the request. I think that it should be consistent, and all databases connections should be closed. Sorry for not having a patch handy, but the fix would be (untested):

In django/db/ change close_connection to:

def close_connection(**kwargs):
    for connection in connections.all():

Change History (2)

comment:1 Changed 11 years ago by Alex Gaynor

Triage Stage: UnreviewedReady for checkin

Yep, this is correct. I remembered to do it in reset_queries() fwiw :/

comment:2 Changed 11 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [12008]) Fixed #12452 -- Ensured that all connections are closed when a request is finished. Thanks to samuel@… for the report and fix.

Note: See TracTickets for help on using tickets.
Back to Top