[ 
https://issues.apache.org/jira/browse/HTTPCORE-740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17713491#comment-17713491
 ] 

Arunan Sugunakumar commented on HTTPCORE-740:
---------------------------------------------

Hi,

Please find the detailed analysis below.

In httpcore-nio 4.4.13 during a timeout scenario, after the client sends FINACK 
to the server, the server does not respond with a FINACK and closes the 
connection with RESET packet after some time. 

!Screenshot 2023-04-18 at 13.45.10.png|width=699,height=192!

In httpcore-nio 4.4.14, after the client sends FINACK to the server, the server 
promptly sends a FINACK back and closes the connection. I believe this has been 
fixed due to this fix[1]. The server still has a read mask during the CLOSING 
state and it reads the FINACK from the client and sends FINACK back before 
closing the connection gracefully.

!Screenshot 2023-04-18 at 13.44.01.png|width=702,height=163!

In httpcore-nio 4.4.16, again this behavior has broken due to the fix[2]. Since 
we are no longer listening to the client FINACK during CLOSING state, the 
server does not respond back with a FINACK and closes the connection 
gracefully. As a result, a RESET packet gets sent to the client after some time.

!Screenshot 2023-04-18 at 13.43.02.png|width=714,height=124!

 

You can find a reproducer here[3] and the above behavior can be tested with the 
below curl command.
{code:java}
curl -X POST -k 'https://localhost:8443' -v {code}
[1]- 
[https://github.com/apache/httpcomponents-core/commit/bf12c7dd9eabf0cd75bd6c70ac6b285b0d4430a5]

[2]- 
https://github.com/apache/httpcomponents-core/commit/608347c1636a06a9515d326285ac26db0c9c9a4a

[3]- [^HttpNIOTestServer-740.zip]

 

Thanks & Regards,
Arunan

> Connection resets during timeouts
> ---------------------------------
>
>                 Key: HTTPCORE-740
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-740
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.4.16
>            Reporter: Arunan Sugunakumar
>            Priority: Major
>         Attachments: HttpNIOTestServer-740.zip, Screenshot 2023-04-18 at 
> 07.53.12.png, Screenshot 2023-04-18 at 13.43.02.png, Screenshot 2023-04-18 at 
> 13.44.01.png, Screenshot 2023-04-18 at 13.45.10.png
>
>
> We observed an issue where with a httpcore-nio server timeout scenario, the 
> server sends a FINACK to the client and if the client sends a close_notify 
> alert, the server is immediately sending a RESET and closing the connection. 
> Ideally, the server should also send a close_notify and terminate the 
> connection gracefully. This issue is observed with only the clients which 
> send close_notify for a server FINACK. The below attached is a TCP capture 
> during the timeout scenario (server port: 8253).  The server uses the latest 
> 4.4.16 httpcore-nio library.
> !Screenshot 2023-04-18 at 07.53.12.png|width=1466,height=150!
> Is there any way to avoid this scenario and send a close_notify from the 
> server as well to terminate the connection gracefully? 
> PS: I am currently working on a simple reproducer to attach here, and I'll 
> attach it as soon as possible. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to