You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2022/11/21 22:28:04 UTC
[Bug 66358] New: Need a way to close socket of the async request after it was committed
https://bz.apache.org/bugzilla/show_bug.cgi?id=66358
Bug ID: 66358
Summary: Need a way to close socket of the async request after
it was committed
Product: Tomcat 9
Version: 9.0.65
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: enhancement
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: a701440@gmail.com
Target Milestone: -----
It's possible to terminate the regular servlet request after the http code 200,
response headers and some data was sent to the client by throwing an exception.
In that case the socket is closed asap and the client receives some form of
failed response with truncated chunk encoding or too short for the
content-length.
It does not appear that there is a way to perform a similar "abort" for async
requests. AsyncContext.complete() only allows normal completion. There is no
API similar to AsyncContext.fail(cause).
If the the async response is in progress and is committed and then some error
happens on the server there is no way to abort the response and close the
socket.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66358] Need a way to close socket of the async request after it was committed
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66358
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Mark Thomas <ma...@apache.org> ---
The Tomcat project does not define the Servlet API. That is the responsibility
of the Jakarta Servlet project. There is an open enhancement request for this
feature:
https://github.com/jakartaee/servlet/issues/98
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
[Bug 66358] Need a way to close socket of the async request after it was committed
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66358
--- Comment #1 from Alex <a7...@gmail.com> ---
What I am executing using internal APIs to achieve the desired effect is
something like this:
AsyncContextImpl asyncContextImpl = (AsyncContextImpl)
asyncContext;
Request req = (Request) requestField.get(asyncContextImpl);
req.getCoyoteRequest().action(ActionCode.CLOSE_NOW, null);
This is obviously a fairly bad idea, but I could not find any other options.
I am also not sure if the above code would not leak some resources in Tomcat.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org