Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#9106 closed Uncategorized (wontfix)

django.views.static.serve reads entire file in to memory

Reported by: manfre Owned by: nobody
Component: Uncategorized Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django.views.static.serve eats a lot of memory when serving large files in a dev environment. Instead of doing open(fullpath, 'rb').read(), it would be friendlier if it passed an iterator to HttpResponse.

Attached is a patch.

Attachments (1)

django-static-serve-chunks.diff (1.1 KB) - added by Michael Manfre <mmanfre@…> 7 years ago.

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by Michael Manfre <mmanfre@…>

comment:1 Changed 7 years ago by mattmcc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

This is a small part of a much larger issue. See #7581 for some discussion of the various subtle challenges to streaming HttpResponses.

comment:2 Changed 7 years ago by mtredinnick

  • Resolution set to wontfix
  • Status changed from new to closed

I don't think this is worth it. We're not guaranteeing that HttpResponse won't read the contents into memory either (which might be necessary to fix some other bugs). This is the development server. If things are getting that tight memory-wise, you can fairly rapidly switch to using a real webserver for serving the static data.

It's fairly borderline, but things like this that are trying to extend the envelope for the development server "just a bit further" usually feel like cases where you should just configure Apache or something and use that. It's not that hard.

comment:3 Changed 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:4 Changed 3 years ago by aaugustin

  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset

Well, this was reported again as #15281 and fixed.

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