You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Yannick Dylla (Jira)" <ji...@apache.org> on 2019/10/16 10:04:00 UTC

[jira] [Updated] (HTTPCORE-607) Unwanted/wrong http header after keep alive timeout

     [ https://issues.apache.org/jira/browse/HTTPCORE-607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yannick Dylla updated HTTPCORE-607:
-----------------------------------
    Description: 
Hi,
I think I found a regression or rather a bug. I noticed that {{httpcore-nio:4.4.11}} is always sending a 504 gateway timeout header after a connection times out. This also happens with keep alive connections where the application code already send a valid response, which then leads to the client receiving an unexpected http header. Many clients seam to ignore it but this is not valid http.

This behavior was added with HTTPCORE-482 and thus {{httpcore-nio:4.4.6}} is the last version that in my opinion works correctly by just closing the tcp connection. Maybe a solution is that the connection remembers that it already send a response instead of a complete reset and now is in keep alive mode?

You can see/reproduce this with the following server & client example while capturing their traffic with wireshark.
1. Start wireshark with the filter: {{tcp.srcport == 12345 || tcp.dstport == 12345}}
2. Start the server ([^KeepAliveExampleServer.java]) which then listens on port 12345 with a 10s socket timeout and always responds with "Hello World".
3. Start the client ([^KeepAliveExampleClient.java]) which will make 3 requests against the server. The 1st & 2nd request should use the same tcp connection. The 3rd should happen after the socket timeout of the server and thus open a new tcp connection.

I have also prepared some captures for you, the unwanted http header is in packet 12 of  [^httpcore-nio-4.4.11-unwanted-504-header.pcapng]. The capture [^httpcore-nio-4.4.6-working.pcapng] shows the expected behavior.

  was:
Hi,
I think I found a regression or rather a bug. I noticed that {{httpcore-nio:4.4.11}} is always sending a 504 gateway timeout header after a connection times out. This also happens with keep alive connection where the application code already send a valid response, which then leads to the client receiving an unexpected http header. Many clients seam to ignore it but this is not valid http.

This behavior was added with HTTPCORE-482 and thus {{httpcore-nio:4.4.6}} is the last version that in my opinion works correctly by just closing the tcp connection. Maybe a solution is that the connection remembers that it already send a response instead of a complete reset and now is in keep alive mode?

You can see/reproduce this with the following server & client example while capturing their traffic with wireshark.
1. Start wireshark with the filter: {{tcp.srcport == 12345 || tcp.dstport == 12345}}
2. Start the server ([^KeepAliveExampleServer.java]) which then listens on port 12345 with a 10s socket timeout and always responds with "Hello World".
3. Start the client ([^KeepAliveExampleClient.java]) which will make 3 requests against the server. The 1st & 2nd request should use the same tcp connection. The 3rd should happen after the socket timeout of the server and thus open a new tcp connection.

I have also prepared some captures for you, the unwanted http header is in packet 12 of  [^httpcore-nio-4.4.11-unwanted-504-header.pcapng]. The capture [^httpcore-nio-4.4.6-working.pcapng] shows the expected behavior.


> Unwanted/wrong http header after keep alive timeout
> ---------------------------------------------------
>
>                 Key: HTTPCORE-607
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-607
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.4.11
>            Reporter: Yannick Dylla
>            Priority: Major
>         Attachments: KeepAliveExampleClient.java, KeepAliveExampleServer.java, httpcore-nio-4.4.11-unwanted-504-header.pcapng, httpcore-nio-4.4.6-working.pcapng
>
>
> Hi,
> I think I found a regression or rather a bug. I noticed that {{httpcore-nio:4.4.11}} is always sending a 504 gateway timeout header after a connection times out. This also happens with keep alive connections where the application code already send a valid response, which then leads to the client receiving an unexpected http header. Many clients seam to ignore it but this is not valid http.
> This behavior was added with HTTPCORE-482 and thus {{httpcore-nio:4.4.6}} is the last version that in my opinion works correctly by just closing the tcp connection. Maybe a solution is that the connection remembers that it already send a response instead of a complete reset and now is in keep alive mode?
> You can see/reproduce this with the following server & client example while capturing their traffic with wireshark.
> 1. Start wireshark with the filter: {{tcp.srcport == 12345 || tcp.dstport == 12345}}
> 2. Start the server ([^KeepAliveExampleServer.java]) which then listens on port 12345 with a 10s socket timeout and always responds with "Hello World".
> 3. Start the client ([^KeepAliveExampleClient.java]) which will make 3 requests against the server. The 1st & 2nd request should use the same tcp connection. The 3rd should happen after the socket timeout of the server and thus open a new tcp connection.
> I have also prepared some captures for you, the unwanted http header is in packet 12 of  [^httpcore-nio-4.4.11-unwanted-504-header.pcapng]. The capture [^httpcore-nio-4.4.6-working.pcapng] shows the expected behavior.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org