Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#9106 closed Uncategorized (wontfix)

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

Reported by: Michael 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@…> 8 years ago.

Download all attachments as: .zip

Change History (5)

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

comment:1 Changed 8 years ago by Matt McClanahan

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedDesign 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 8 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

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 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 Changed 4 years ago by Aymeric Augustin

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

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

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