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 2014/01/13 07:12:37 UTC

[Bug 55996] New: Async context completes with IllegalStateException after around 10 seconds.

https://issues.apache.org/bugzilla/show_bug.cgi?id=55996

            Bug ID: 55996
           Summary: Async context completes with IllegalStateException
                    after around 10 seconds.
           Product: Tomcat 7
           Version: 7.0.50
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: hardeepsangha@gmail.com

Created attachment 31200
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31200&action=edit
Servlet with Async processing and Java Based client

I created a ProblemServlet which receives request via a Java based client. The
Servlet starts an Async processing for each request.
Within the Async processing run() method there is a while loop which cyclically
sends String messages to the client. The implementation of run method is shown.

public void run()
        {
            try
            {
                String msg = "";
                ServletOutputStream outputStream =
publisherAsyncCtx.getResponse().getOutputStream();
                boolean continu = true;

                while (continu)
                {
                    msg = "";

                    msg = "|" + " " + new Date();
                    System.out.println("publishing message... " + msg);

                    outputStream.println(msg);
                    publisherAsyncCtx.getResponse().flushBuffer();

                    try
                    {
                        Thread.sleep(1000);
                    }
                    catch (InterruptedException e)
                    {
                        System.out.println("sleep InterruptedException: " +
e.getMessage());
                        e.printStackTrace();
                    }
                }
            }

When a Java based console application client hits this servlet and reads its
output stream, for around 10 sec the messages arrive. But after 10 seconds the
connection is closed by the server.

Logs on the Server side:
Starting the Async Context.
publishing message... | Mon Jan 13 11:28:30 IST 2014
publishing message... | Mon Jan 13 11:28:31 IST 2014
publishing message... | Mon Jan 13 11:28:32 IST 2014
publishing message... | Mon Jan 13 11:28:33 IST 2014
publishing message... | Mon Jan 13 11:28:34 IST 2014
publishing message... | Mon Jan 13 11:28:35 IST 2014
publishing message... | Mon Jan 13 11:28:36 IST 2014
publishing message... | Mon Jan 13 11:28:37 IST 2014
publishing message... | Mon Jan 13 11:28:38 IST 2014
publishing message... | Mon Jan 13 11:28:39 IST 2014
publishing message... | Mon Jan 13 11:28:40 IST 2014
publishing message... | Mon Jan 13 11:28:41 IST 2014
Exception in thread "http-bio-8080-exec-6" java.lang.IllegalStateException: The
request associated with the AsyncContext has already completed processing.
    at
org.apache.catalina.core.AsyncContextImpl.check(AsyncContextImpl.java:521)
    at
org.apache.catalina.core.AsyncContextImpl.getResponse(AsyncContextImpl.java:245)
    at
com.pg.orion.artcloopcheck.ProblemServlet$AsynRunnable.run(ProblemServlet.java:67)
    at
org.apache.catalina.core.AsyncContextImpl$RunnableWrapper.run(AsyncContextImpl.java:557)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)


Issue is seen with "apache-tomcat-7.0.50", "apache-tomcat-7.0.47". Not tested
with other release 7 variants.
The same codebase when run on "apache-tomcat-8.0.0-RC10" there are no issues.

-- 
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 55996] Async context does not timeout with HTTP NIO connector

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Catalina                    |Catalina
            Version|7.0.50                      |trunk
            Product|Tomcat 7                    |Tomcat 8
   Target Milestone|---                         |----
            Summary|Async context completes     |Async context does not
                   |with IllegalStateException  |timeout with HTTP NIO
                   |after around 10 seconds.    |connector

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Tomcat 7 is behaving correctly. It is 8.0.x that has the bug. The Async context
should timeout unless there is a call to dispatch() or complete() within the
timeout. 8.0.x appears to be resetting the timeout counter on every write which
is not correct.

-- 
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 55996] Async context completes with IllegalStateException after around 10 seconds.

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

Hardeep <ha...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hardeepsangha@gmail.com
                 OS|                            |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 55996] Async context does not timeout with HTTP NIO connector

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

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

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

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
This has been fixed in 8.0.x for 8.0.0 and in 7.0.x for 7.0.51.

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