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

            Bug ID: 58230
           Summary: Incorrect input from ServletInputStream in
                    ReadListener
           Product: Tomcat 8
           Version: 8.0.24
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: rstoyanc...@yahoo.com

I have a reproducible case where the bytes read with ServletInputStream via a
javax.servlet.ReadListener are incorrect.

The code is an experiment with layering Reactive Streams over Servlet 3.1
non-blocking I/O. I apologize for not being able to create a more focused
isolated example (I did try). That said it is a very basic example that
hopefully with some debugging you can zero in on the issue.

To observe the failure, clone
https://github.com/spring-projects/spring-reactive, then change the following
read buffer size to 4096
https://github.com/spring-projects/spring-reactive/blob/master/src/main/java/org/springframework/reactive/web/servlet/HttpHandlerServlet.java#L37,
then run the test
https://github.com/spring-projects/spring-reactive/blob/master/src/test/java/org/springframework/reactive/web/servlet/HttpHandlerServletTomcatIntegrationTests.java.

The test sends an HTTP request with a body of 3 * 4096 bytes. The server echoes
that back. However the returned body doesn't match starting at index 4096,
which happens to be the start of the second chunk.

On the server requests are delegated to an HttpHandler which accepts a
(Reactive Streams) Publisher for the input and returns a Publisher for the
output. In the test the HttpHandler is EchoHandler which returns the input
Publisher as the response Publisher effectively piping input directly to
output. Underlying that are RequestBodyPublisher and ResponseBodySubscriber
which adapt the Read/WriteListener to Reactive Streams.

Increasing the size of the array into which chunks are read to 4293 makes the
tests pass.

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