RFR: 6968351: httpserver clashes with delayed TCP ACKs for low Content-Length [v2]

Daniel JeliƄski djelinski at openjdk.org
Fri Apr 19 16:06:06 UTC 2024


On Fri, 19 Apr 2024 15:47:15 GMT, robert engels <duke at openjdk.org> wrote:

>> test/jdk/com/sun/net/httpserver/bugs/B6968351.java line 90:
>> 
>>> 88:             is.close();
>>> 89:             rmap.add("content-type","text/plain");
>>> 90:             t.sendResponseHeaders(200,5);
>> 
>> if I read the code correctly, there might be a similar delay when sending the last chunk of a chunked response. Would you like to fix it here as well? If not, we can file another ticket for it.
>> 
>> In order to send a chunked response, change the second parameter to `0` here.
>
> If you send a chunked response you must close the exchange, or close the output stream, or there is no way to determine the data is done.

The problem with closing a chunked stream is that it flushes both before and after the final chunk. I assume it may also cause delays.

The only case when you don't need to close the exchange or the output stream is when your response contains no content.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18667#discussion_r1572602425


More information about the net-dev mailing list