#18434: Limit ModelFormSet queryset parameter
--------------------------------------+--------------------
Reporter: sbaechler | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Forms | Version: 1.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
This error happened to us a while ago (with Django 1.2.3) and I don't know
if the issue has been fixed since. But I didn't find anything in the
history.
The issue was this. One of our servers was starting to not react for
several seconds a few times every day. The processor load went up to 200%
and it had to use disk cache because it run out of RAM. It took us a while
until we found the issue:
A few ModelFormSets were instantiated without the queryset parameter. Just
POST data, which was sufficient for the app to work. There was no
performance issue while the database had only a few entries but once it
reached a few thousand, it brought the server down.
The issue was resolved once I added the queryset parameter. I don't know
if it was caused because of the missing queryset parameter or the fact
that the default manager returned a few thousand entries.
But it should be possible to add a fail-safe or warning if the queryset
and data that comes in via POST don't match. Isn't it possible to get the
primary keys from the POST data?
The formsets were created using the modelformset_factory. I have attached
the view code.
--
Ticket URL: <https://code.djangoproject.com/ticket/18434>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.