[Django] #29117: Excessive memory use when multiple objects retrieved using objects.get()

12 views
Skip to first unread message

Django

unread,
Feb 5, 2018, 4:43:20 PM2/5/18
to django-...@googlegroups.com
#29117: Excessive memory use when multiple objects retrieved using objects.get()
-------------------------------------+-------------------------------------
Reporter: caseydm | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.8
layer (models, ORM) |
Severity: Normal | Keywords: obejcts.get
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I recently discovered a bug in my application that is running on Django
1.8.18 with python 2.7.14. This code is used to retrieve names using a
slug:

{{{
try:
record = record_class.objects.get(**filter_params)

except record_class.MultipleObjectsReturned:
# deal with multiple records
}}}

Most names are single objects, but occasionally a name like 'not provided'
will come through and return 1,000 results or more. In that instance,
record_class.objects.get(**filter_params) spikes in memory usage from 56mb
to 344mb. On Heroku, running this query a few times quickly maxes out all
available memory, and the app stays that way until the dynos are
restarted.

--
Ticket URL: <https://code.djangoproject.com/ticket/29117>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 5, 2018, 10:23:43 PM2/5/18
to django-...@googlegroups.com
#29117: Excessive memory use when multiple objects retrieved using objects.get()
-------------------------------------+-------------------------------------
Reporter: caseydm | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:
Keywords: obejcts.get | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

I guess that could be solved by #6785. Do you have another proposal?

--
Ticket URL: <https://code.djangoproject.com/ticket/29117#comment:1>

Django

unread,
Feb 6, 2018, 7:19:03 PM2/6/18
to django-...@googlegroups.com
#29117: Excessive memory use when multiple objects retrieved using objects.get()
-------------------------------------+-------------------------------------
Reporter: caseydm | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution: duplicate

Keywords: obejcts.get | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => duplicate


--
Ticket URL: <https://code.djangoproject.com/ticket/29117#comment:2>

Reply all
Reply to author
Forward
0 new messages