#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/058.8bc564efbf816c61ce300f0ed44018d4%40djangoproject.com.