#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.26a043e4c49e6bde3eae787ab02b91c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.