Opened 15 years ago

Closed 15 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: dev
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

Description

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/init.py change close_connection to:

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

Change History (2)

comment:1 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedReady for checkin

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

comment:2 by Russell Keith-Magee, 15 years ago

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