https://issues.apache.org/bugzilla/show_bug.cgi?id=56871
--- Comment #5 from Konstantin Kolinko <knst.koli...@gmail.com> ---

> I traced it as best I could, and it *seems* that the
> InternalNioInputBuffer$SocketInputBuffer is reading the data
> from the socket 'out of order' (very, very rarely)

>From EchoServlet.java
>            if( !sb.toString().equals("a246722a276771371e1807a92f3bc86f") ) {
>              System.err.println("Unexpected data value: \n"+ new 
> String(bytes));
>            }

1. I see that your code detects broken data by their MD5 digest and prints them
to System.err. Can you provide samples of such output? If data are read out of
order, it will be visible in the printed text.

> while( (len=sis.read(buffer, 0, 8*1024)) >0 ) {

2. Just as a note: My first impression was that I want ">=0" in the above line.
The end of data is signaled by value of "-1", not by 0.

On further reading of javadoc of InputStream.read(byte[]) I see that this
method has to block until at least one byte is read and is not allowed to
return "0".

3. ServletInputStream.read() is allowed to throw an IOException. E.g. it may
throw SocketTimeoutException.

>From client.js:
> var options = {
>  ...
>  headers: { "Content-Length": 3668}
>};
> ...
>  req.write('Lorem ipsum dolor sit amet [...]

4. So I guess that it uses explicit Content-Length length and not chunked
transfer-encoding. 
My text editor shows that "Lorem ipsum dolor" string is 3678 characters, not
3668.

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