Opened 5 years ago

Closed 3 years 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 5 years ago by anonymous

Type: UncategorizedBug

comment:2 Changed 5 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

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

comment:3 Changed 5 years ago by tuxcanfly

Cc: tuxcanfly added
Has patch: set
Owner: changed from nobody to tuxcanfly
Status: newassigned

comment:4 Changed 4 years ago by Tim Graham

Patch needs improvement: set

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

comment:5 Changed 3 years ago by Claude Paroz

Owner: tuxcanfly deleted
Patch needs improvement: unset
Status: assignednew

comment:6 Changed 3 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:7 Changed 3 years ago by Claude Paroz <claude@…>

Owner: set to Claude Paroz <claude@…>
Resolution: fixed
Status: newclosed

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