2015-05-26 19:32 GMT+02:00 Mark Thomas <ma...@apache.org>:

> On 26/05/2015 18:27, Rémy Maucherat wrote:
> > 2015-05-26 19:20 GMT+02:00 <ma...@apache.org>:
> >
> >> Author: markt
> >> Date: Tue May 26 17:20:12 2015
> >> New Revision: 1681794
> >>
> >> URL: http://svn.apache.org/r1681794
> >> Log:
> >> Fix NIO2 test failures.
> >>
> > I don't understand what these failures suddenly come from, but this is
> > likely wrong: it is possible there is no pending read.
>
> The failures are timing related. I suspect they were always possible and
> just become more likely when I tweaked the code around non-blocking read
> of the request line.
>
> The problem was that there were two reads in progress. One from the read
> triggered by the non-blocking read of the request line and one from the
> awaitBytes() call triggered if the above non-blocking read returned zero.
>
> What are the scenarios that we do need to call awaitBytes() ?
>

So addToPoller needed to be true, that only happens for simple HTTP/1.1
keepalive. I don't see any guarantee there's a pending read really, so it
sounds logical to me.

As far as I am concerned, the tweaking of the request line looks wrong.

                 if (pos >= lastValid) {
-                    if (useAvailableDataOnly) {
-                        return false;
+                    if (keptAlive) {
+                        // Haven't read any request data yet so use the
keep-alive
+                        // timeout.
+
wrapper.setReadTimeout(wrapper.getEndpoint().getKeepAliveTimeout());
                     }

Ok to change the timeout if you like (although for NIO2 it's meaningless if
the operation is already pending), but more importantly why is the "return
false" gone ?

Rémy

Reply via email to