Opened 7 years ago

Last modified 2 months ago

#10919 new New feature

Add an option to disable display of related items on admin's delete confirmation page (to prevent large memory usage on complex objects)

Reported by: tobias Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords: admin memory limit
Cc: aaron@…, sasha@…, michal@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I recently tried to delete an object in the admin that had several million related objects.

The server quickly ran out of memory as the apache process's memory usage ballooned upwards to near a gigabyte.

I assume this is because it was trying to create an HTML page listing out all the related objects.

Can the admin page do a count and/or limit to avoid this?

I'm using Django 1.1 trunk (r10628), mod_wsgi 2.0, and apache 2.2.8.

Change History (8)

comment:1 Changed 7 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by lukeplant

  • Severity set to Normal
  • Type set to Bug

comment:3 Changed 5 years ago by anonymous

  • Easy pickings unset
  • UI/UX unset

This bug is still sitting around. Maybe we should document it somewhere, that for complex objects...

comment:4 Changed 10 months ago by timgraham

  • Summary changed from admin object deletion confirmation page causes server out of memory error to Add an option to disable display of related items on admin's delete confirmation page (to prevent large memory usage on complex objects)
  • Type changed from Bug to New feature
  • Version changed from 1.1-beta to master

An option to disable or limit the display of related objects on the delete confirmation page seems like a workable solution here (other ideas welcome).

comment:5 Changed 8 months ago by darkpixel

  • Cc aaron@… added

comment:6 Changed 6 months ago by sasha0

  • Cc sasha@… added

A property for ModelAdmin ?

comment:7 Changed 2 months ago by nijel

Adding such property to ModelAdmin sounds like a good idea.

I've workarounded it myself by removing deleted_objects before rendering the template:

    def render_delete_form(self, request, context):
        context['deleted_objects'] = [_('Object listing disabled')]
        return super(ProjectAdmin, self).render_delete_form(request, context)

This way I will get the summary (so that user has idea what he is deleting), but not object list as it is too long to get displayed.

comment:8 Changed 2 months ago by nijel

  • Cc michal@… added
Note: See TracTickets for help on using tickets.
Back to Top