jira-importer opened a new issue, #1309:
URL: https://github.com/apache/httpcomponents-core/issues/1309

   **[Arunan 
Sugunakumar](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=arunans23)**
 opened 
**[HTTPCORE-755](https://issues.apache.org/jira/browse/HTTPCORE-755?redirect=false)**
 and commented
   
   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
   
   
   ---
   
   **Affects:** 4.4.16
   
   **Attachments:**
   - 
[chunk-backend.zip](https://issues.apache.org/jira/secure/attachment/13061566/chunk-backend.zip)
 (_5.74 MB_)
   - 
[Jmeter_script_1.jmx](https://issues.apache.org/jira/secure/attachment/13061565/Jmeter_script_1.jmx)
 (_6.41 kB_)
   - 
[NHttpReverseProxy.zip](https://issues.apache.org/jira/secure/attachment/13061567/NHttpReverseProxy.zip)
 (_1.07 MB_)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to