Arunan Sugunakumar created HTTPCORE-755:
-------------------------------------------
Summary: Connection gets closed prematurely before Decoder gets
completed
Key: HTTPCORE-755
URL: https://issues.apache.org/jira/browse/HTTPCORE-755
Project: HttpComponents HttpCore
Issue Type: Bug
Components: HttpCore NIO
Affects Versions: 4.4.16
Reporter: Arunan Sugunakumar
Attachments: Jmeter_script_1.jmx, NHttpReverseProxy.zip,
chunk-backend.zip
Hi,
In httpcore-nio 4.4.16, sometimes the closed event (in NHttpClientEventHandler)
gets triggered before the ContentDecoder gets completed. This is observed when
the backend sends Chunk decoded messages and immediately closes the connection.
Also to reproduce the issue, we had to do a load test with 20 threads and host
the server and client on two different virtual machines.
When we added debug logs, we found that the SSLIOsession goes into CLOSING
state[1] while there are remaining data available in the inPlain buffer. As a
result, the closeOutbound is called on the SSLEngine[2]. This sometimes makes
the HandshakeStatus into NEED_UNWRAP which makes the session go into CLOSED
state[3]. As a result, the session gets closed before consuming the data in the
inPlain buffer.
I reproduced this scenario with the NHttpReverseProxy sample with the attached
backend and invoked the ReverseProxy with a Jmeter script. I placed the backend
jar in another server and the Proxy sample in another and invoked the Jmeter
client from the local machine.
The issue does not occur in httpcore-nio 4.4.9 but only from 4.4.10. This is
occurring because we are making the session go into CLOSING state for
endOfStream with this commit[4].
[1] -
[https://github.com/apache/httpcomponents-core/blob/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java#L387]
[2] -
[https://github.com/apache/httpcomponents-core/blob/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java#L390]
[3] -
[https://github.com/apache/httpcomponents-core/blob/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java#L401]
[4] -
[https://github.com/apache/httpcomponents-core/commit/08d9c3c30d57def4963d0807bce5f3023f5fcb35]
Regards,
Arunan
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]