bug in timeout disconnect with pending output
---------------------------------------------
Key: HTTPCORE-117
URL: https://issues.apache.org/jira/browse/HTTPCORE-117
Project: HttpComponents Core
Issue Type: Bug
Components: HttpCore NIO
Affects Versions: 4.0-alpha5
Reporter: David Koski
Priority: Minor
I ran into some trouble where I had a connection that was timing out but still
had unsent data. This method gets called:
org.apache.http.impl.nio.DefaultClientIOEventDispatch.timeout(IOSession)
which calls these (in my case):
org.apache.http.nio.protocol.BufferingHttpClientHandler.timeout(NHttpClientConnection)
org.apache.http.impl.nio.NHttpConnectionBase.close()
finally coming to close the connection itself:
public void close() throws IOException {
this.closed = true;
if (this.outbuf.hasData()) {
this.session.setEvent(EventMask.WRITE);
} else {
this.session.close();
}
}
However, this.outbuf DID have data, so it just marked itself for writing. The
connection was in no better shape, so after the connect timeout expired, it
called this method again. And again. There may be a good reason that it was
done this way, but it looks like it causes a problem.
I am not sure what state the connection was in, but it looked like the
connection was established and NO data had been sent. I noticed that the
hasBufferedOutput flag was false, though there was actually data to send. That
is set here:
public void produceOutput(final NHttpClientHandler handler) {
...
} finally {
// Finally set buffered output flag
this.hasBufferedOutput = this.outbuf.hasData();
}
which suggests that this method was never called. I can't say if that was a
problem in the client or the server (load balancer in this case) just wasn't
handling any input.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]