Opened 5 years ago

Closed 5 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: UI/UX:

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 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

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

comment:2 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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