[Django] #31563: Document edge case with uwsgi, wsgi.file_wrapper and BytesIO

11 views
Skip to first unread message

Django

unread,
May 10, 2020, 5:17:30 PM5/10/20
to django-...@googlegroups.com
#31563: Document edge case with uwsgi, wsgi.file_wrapper and BytesIO
-------------------------------------+-------------------------------------
Reporter: Sergei | Owner: nobody
Maertens |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 3.0
Documentation | Keywords: wsgi.file_wrapper,
Severity: Normal | uwsgi, streaming responses
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
The [https://docs.djangoproject.com/en/3.0/ref/request-response
/#fileresponse-objects FileResponse] documentation mentions both the usage
of `BytesIO` and possible optimizations with `wsgi.file_wrapper`.

Just today I was hit by https://github.com/unbit/uwsgi/issues/1126, which
didn't manifest with `runserver`, because uwsgi optimizes this using
`sendfile`. However, this is not a combination that works when you're
using `BytesIO` instead of actual file handles, and uwsgi will error.

Of course, this is a very uwsgi-specific thing, and I'm not sure if it
happens with gunicorn or other wsgi-servers too, but it might be good to
document this where the usage of `wsgi.file_wrapper` is documented.

--
Ticket URL: <https://code.djangoproject.com/ticket/31563>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 12, 2020, 6:12:38 AM5/12/20
to django-...@googlegroups.com
#31563: Document edge case with uwsgi, wsgi.file_wrapper and BytesIO.
-------------------------------------+-------------------------------------
Reporter: Sergei Maertens | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 3.0
Severity: Normal | Resolution: wontfix
Keywords: wsgi.file_wrapper, | Triage Stage:
uwsgi, streaming responses | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => wontfix


Comment:

It's too niche IMO. We cannot document all caveats.

--
Ticket URL: <https://code.djangoproject.com/ticket/31563#comment:1>

Reply all
Reply to author
Forward
0 new messages