| Age | Commit message (Collapse) | Author |
|
Error response handling frequently makes use of the database, and so
must use the request specific connection sensitive worker thread.
Previously response_for_exception was dispatched on the event loop's
default executor. This potentially leads to pool exhaustion, and
deadlock, when using database pooling option, or a large number of
permanently held open database connections when not using pooling.
Connections held open were not subject to cleanup. If closed server
side, the reported "connection is closed" would be seen until
application restart.
Moving error response rendering to the request specific connection
sensitive worker thread resolves both of these issues.
The `thread_sensitive=False` was set in
e17ee4468875077b90b70bb6a589ebad7493f757 to maintain the prior
behaviour when asgiref switched the thread_sensitive default to
`True`. There was no specific reason for the non-tread-sensitive
behaviour beyond that. (With hindsight it was always incorrect for
the reasons here.)
|
|
|
|
MemoryFileUploadHandler on ASGI.
In ASGI deployments, Content-Length is not guaranteed to reflect the
actual request body size, so relying on it to gate memory allocation
allowed the limit to be bypassed. The handler now enforces
DATA_UPLOAD_MAX_MEMORY_SIZE regardless of the declared header value.
Thanks to Kyle Agronick for the report. Refs #35289.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
ASGI requests.
The `body` property in `HttpRequest` checks DATA_UPLOAD_MAX_MEMORY_SIZE
against the declared `Content-Length` header before reading. On the ASGI
path, chunked requests carry no `Content-Length`, so the check evaluated
to 0 and always passed regardless of the actual body size.
This work adds a new check on the actual number of bytes consumed.
Thanks to Superior for the report, and to Jake Howard and Jacob Walls
for reviews.
|
|
Thanks Tarek Nakkouch for the report and Jake Howard and Natalia Bidart
for reviews.
|
|
Thanks Jiyong Yang for the report, and Natalia Bidart, Jacob Walls, and
Shai Berger for reviews.
|
|
Follow-up to c042fe3a74fb213c93b1052f7de4d99a6e6948e0.
The original ignore was added in 0bd2c0c9015b53c41394a1c0989afbfd94dc2830
but was not adjusted when the stacklevel changed.
|
|
ASGIRequest.
Signed-off-by: SaJH <wogur981208@gmail.com>
|
|
|
|
Thanks Carlton Gibson for reviews.
|
|
https://github.com/PyCQA/flake8/releases/tag/7.2.0
|
|
|
|
enforce specific interleaving.
Sleep call leads to a hard to trace error in CI. Using an Event is
more deterministic, and should be less prone to environment
variations.
Bug in 11393ab1316f973c5fbb534305750740d909b4e4.
|
|
signal.
Prior to this work, when async tasks that process the request are cancelled due
to receiving an early "http.disconnect" ASGI message, the request_finished
signal was not being sent, potentially leading to resource leaks (such as
database connections).
This branch ensures that the request_finished signal is sent even in the case
of early termination of the response.
Regression in 64cea1e48f285ea2162c669208d95188b32bbc82.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
|
|
other tests.
|
|
|
|
|
|
|
|
Bug in 0bd2c0c9015b53c41394a1c0989afbfd94dc2830.
|
|
|
|
Thanks to Florian Vazelle for initial exploratory work, and to Nick
Pope and Mariusz Felisiak for review.
|
|
ASGI tests.
|
|
|
|
Regression in 441103a04d1d167dc870eaaf90e3fba974f67c93.
|
|
Underlying issue was fixed in Python 3.8.1, now many versions ago.
https://bugs.python.org/issue38563
|
|
|
|
By using a asgiref's ThreadSensitiveContext context manager, requests
will be able to execute independently of other requests when sync work
is involved.
Prior to this commit, a single global thread was used to execute any
sync work independent of the request from which that work was scheduled.
This could result in contention for the global sync thread in the case
of a slow sync function.
Requests are now isolated to their own sync thread.
|
|
docs where appropriate.
|
|
types.
|
|
|
|
sensitive.
|
|
This implements support for asynchronous views, asynchronous tests,
asynchronous middleware, and an asynchronous test client.
|
|
|
|
|
|
Refs https://bugs.python.org/issue38563.
|
|
|
|
This adds an ASGI handler, asgi.py file for the default project layout,
a few async utilities and adds async-safety to many parts of Django.
|