[Bug 62982] New: Tomcat is not waiting for async requests to complete their work on shutdown

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 62982] New: Tomcat is not waiting for async requests to complete their work on shutdown

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62982

            Bug ID: 62982
           Summary: Tomcat is not waiting for async requests to complete
                    their work on shutdown
           Product: Tomcat 7
           Version: 7.0.92
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

I am heavily using asynchronous API in my application, which is running on
Tomcat 7. One of the requirements that I have -- permit all requests that are
currently in flight to complete their work before termination.

I have the following properties set for each of my connectors in server.xml:
               asyncTimeout="40000"
               executorTerminationTimeoutMillis="60000"

I have thrown a 10 seconds sleep into one of my services and I place a curl
request against my server, then immediately I request a shutdown of a tomcat
service.

curl sits there for about 10 seconds and then it returns 502 from tomcat.

Additionally, in catalina.out, I see the following stack trace:

INFO: Waiting for 1 instance(s) to be deallocated for Servlet [jersey-servlet]
Dec 05, 2018 7:13:37 PM org.apache.catalina.connector.CoyoteAdapter
checkRecycled
INFO: Encountered a non-recycled request and recycled it forcedly.
org.apache.catalina.connector.CoyoteAdapter$RecycleRequiredException
    at
org.apache.catalina.connector.CoyoteAdapter.checkRecycled(CoyoteAdapter.java:634)
    at
org.apache.coyote.http11.AbstractHttp11Processor.recycle(AbstractHttp11Processor.java:1909)
    at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.release(Http11NioProtocol.java:220)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:720)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1775)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1734)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I believe it indicates that something is not working as expected: seems like
HTTP connectors are being shut down prematurely.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 62982] Tomcat is not waiting for async requests to complete their work on shutdown

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62982

Mark Thomas <[hidden email]> changed:

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

--- Comment #1 from Mark Thomas <[hidden email]> ---
You are making incorrect assumptions about the meaning of asyncTimeout and
executorTerminationTimeoutMillis.


You need to look at:
http://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Common_Attributes
and search for
unloadDelay

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 62982] Tomcat is not waiting for async requests to complete their work on shutdown

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62982

--- Comment #2 from [hidden email] ---
In order to achieve the behavior that I've described, seems that "unloadDelay"
has to be set along with "asyncTimeout" and "executorTerminationTimeoutMillis".
Is my understanding correct?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]