Opened 3 years ago

Closed 21 months ago

#21255 closed Bug (fixed)

Django doesn't closes connection when running from management command

Reported by: kabakov.as@… 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

Description

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

Walkaround to problem may be found here: http://stackoverflow.com/questions/16841505/django-resetting-postgres-connection

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

When runned as ./manage.py 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: UncategorizedBug

comment:2 Changed 3 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 3 years ago by tuxcanfly

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

comment:4 Changed 2 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 21 months ago by Claude Paroz

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

comment:6 Changed 21 months ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:7 Changed 21 months 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 kabakov.as@… for the report, and Aymeric Augustin,
Simon Charette for the reviews.

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