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 2020/12/17 15:38:53 UTC

[Bug 65001] New: HTTPNIO non-blocking IO servlet 3.1 API may fail to alert webapp that a request is complete

https://bz.apache.org/bugzilla/show_bug.cgi?id=65001

            Bug ID: 65001
           Summary: HTTPNIO non-blocking IO servlet 3.1 API may fail to
                    alert webapp that a request is complete
           Product: Tomcat 9
           Version: 9.0.41
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: frrajott@cisco.com
  Target Milestone: -----

Created attachment 37624
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37624&action=edit
Test servlet

Under certain IO error conditions, tomcat will fail to alert that an
asynchronous request is completed and destroyed.
Both the AsyncListener's onComplete method and ServletRequestListener's
requestDestroyed method are not called.
This may cause a webapp to believe that a request is still valid while tomcat
has already recycled the objects.

I was able to reproduce this issue using a WriteListener (non-blocking IO
servlet API 3.1) with the httpnio connector on the latest tomcat release
(9.0.41).
This appears to be caused when an IOException is raised while attempting to
write to the ServletOutputChannel during the WriteListener's onWritePossible
callback.

It also seems possible to trigger this issue by manually throwing an exception
in the onWritePossible callback.

The following exception can also be seen in the logs:
java.lang.IllegalStateException: Calling [asyncPostProcess()] is not valid for
a request with Async state [ERROR]

I've attached a test servlet that demonstrates this issue.
To simulate IO errors, an http request is aborted before the full response body
is read. The servlet then records various async callbacks it receives and it
can be seen that some callbacks are not always called, i.e. the AsyncListener's
onComplete callback and ServletRequestListener's requestDestroyed callback.
The servlet compares synchronous requests, asynchronous requests, and
asynchronous requests with non-blocking IO.

-- 
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 65001] HTTPNIO non-blocking IO servlet 3.1 API may fail to alert webapp that a request is complete

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65001

frrajott@cisco.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Mac OS X 10.1               |All
           Hardware|PC                          |All

-- 
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 65001] HTTPNIO non-blocking IO servlet 3.1 API may fail to alert webapp that a request is complete

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65001

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Thanks again for the test case. A good test case really does make a huge
difference to how easily we can fix a bug.

Fixed in:
- 10.0.x for 10.0.1 onwards
- 9.0.x for 9.0.42 onwards
- 8.5.x for 8.5.62 onwards

-- 
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 65001] HTTPNIO non-blocking IO servlet 3.1 API may fail to alert webapp that a request is complete

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65001

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the really good test case. I've found a (hopefully the) bug. I'm
currently working on a fix.

-- 
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