You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When a request is being sent, it may be asynchronously aborted.
The current code, upon request abort from thread T1, calls HttpSender.terminateRequest() which may emit the "complete" event (if the response is already completed) while another thread T2 (the sender thread) may still be busy sending the request content from HttpSender.ContentSender, accessing the request's ContentSource to read and demand.
This may be a problem with reproducible request content, for example in case of redirects: the redirect will try to abort the request at the "response success" event from thread T1; the request abort immediately emits the "complete" event, which triggers the call to the request's Content.Source.rewind(), but there is still thread T2 reading/demand from the request ContentSource from the HttpSender.ContentSender.
The request abort should be serialized, so that first the HttpSender.ContentSender returns from process(), then the "complete" event is triggered, and any code relying on the "complete" event is now guaranteed that there is no concurrent access to the request Content.Source.
The text was updated successfully, but these errors were encountered:
* Introduced IteratingCallback.abort(Throwable) to serialize calls to onCompleteFailure().
* HttpSender now uses IC.abort() to serialize the abort of the request.
* Fixed HTTP/2 and HTTP/3 to dispatch the sending of the request to another thread, to free the reader thread that read the server preface.
* HTTP/1.1 does not need this, because just created connections do not need to read.
* Improved handling of request abort, as it can be from two sides: external and internal.
* Calling abort() instead of failed() for WebSocket flushers.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Jetty version(s)
12
Description
When a request is being sent, it may be asynchronously aborted.
The current code, upon request abort from thread T1, calls
HttpSender.terminateRequest()
which may emit the "complete" event (if the response is already completed) while another thread T2 (the sender thread) may still be busy sending the request content fromHttpSender.ContentSender
, accessing the request'sContentSource
to read and demand.This may be a problem with reproducible request content, for example in case of redirects: the redirect will try to abort the request at the "response success" event from thread T1; the request abort immediately emits the "complete" event, which triggers the call to the request's
Content.Source.rewind()
, but there is still thread T2 reading/demand from the requestContentSource
from theHttpSender.ContentSender
.The request abort should be serialized, so that first the
HttpSender.ContentSender
returns fromprocess()
, then the "complete" event is triggered, and any code relying on the "complete" event is now guaranteed that there is no concurrent access to the requestContent.Source
.The text was updated successfully, but these errors were encountered: