Opened 3 years ago

Closed 19 months ago

#21255 closed Bug (fixed)

Django doesn't closes connection when running from management command

Reported by:… Owned by: Claude Paroz <claude@…>
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords: connection postgres management
Cc: tuxcanfly Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When runing django from mangemnt command
Django doesn't closes database connection

Walkaround to problem may be found here:

I think this is a django bug, and django should close connection by it self

When runned as ./ shell
Connection should be automatically closed as well

Change History (7)

comment:1 Changed 3 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Type changed from Uncategorized to Bug

comment:2 Changed 3 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

Yes, the base class for management commands should call django.db.close_connection before exiting.

comment:3 Changed 3 years ago by tuxcanfly

  • Cc tuxcanfly added
  • Has patch set
  • Owner changed from nobody to tuxcanfly
  • Status changed from new to assigned

comment:4 Changed 2 years ago by timo

  • Patch needs improvement set

Current PR has comments for improvement. Please uncheck "Patch needs improvement" when you update it, thanks.

comment:5 Changed 19 months ago by claudep

  • Owner tuxcanfly deleted
  • Patch needs improvement unset
  • Status changed from assigned to new

comment:6 Changed 19 months ago by timgraham

  • Triage Stage changed from Accepted to Ready for checkin

comment:7 Changed 19 months ago by Claude Paroz <claude@…>

  • Owner set to Claude Paroz <claude@…>
  • Resolution set to fixed
  • Status changed from new to closed

In 1d24f073e65113c8c6d974db0504ef7d083809f7:

Fixed #21255 -- Closed connections after management command ran

Thanks… for the report, and Aymeric Augustin,
Simon Charette for the reviews.

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