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

            Bug ID: 61768
           Summary: Processor for async requests are recycled before
                    complete is called on AsyncContext
           Product: Tomcat 8
           Version: 8.5.20
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: herbert.we...@swisscom.com
  Target Milestone: ----

Our Product offers different REST APIs based on jax-rs 2.1 and Jersey 2.26.

We are facing Problems with asynchronous Requests (using
javax.ws.rs.sse.SseEventSink) and the Recycling of Processors
(org.apache.coyote.http11.Http11Processor).

The SSE Endpoints are asynchronous and kept open for a long time.
If the async Context is completed on Server Side, then it works as expected.

But when a Client closes the Connection on Client Side, then the Processor is
recycled and put to the recycled Processors:
org.apache.coyote.AbstractProtocol.ConnectionHandler.release
The asynchronous Thread is still running and will try to write to the Response.

Because the processor (incl. request and Response object) is recycled it will
be reused by another request (synchron or asynchron).

Jersey itself uses the javax.servlet.AsyncContext only to complete once it is
finished, but it does NOT use the getResponse Method. Instead the original
Response is used. This leads to a concurrent use of the very same Response.
We observed different failures because of this (Empty or truncated Responses or
missing reponse headers)

As a Workaround we had to disable the processor pool in the connector:
processorCache="0"
With this Workaround the Problem is not happening anymore.

The proposed fix would be to release asynchronous processors only back to the
poll if they asynchronous processing is completed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to