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

Daniel Jeliński djelinski at openjdk.org
Fri Apr 19 16:19:58 UTC 2024


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

> I think this is a trivial fix. We should be able to either:
> 
> 1. Flush the FixedLengthOutputStream when the bytes remaining is 0.

This is reasonable, and should fix `B8293562`, but it won't fix `B4769350`, which creates a chunked response, and then leaks it. See the `proxyReply` method in that file.

> 2. Always flush the output stream after an exchange completes. This won't affect performance if it has already been flushed()/closed() previously.

The exchange does not automatically complete when you exit the `handle` method; you need to explicitly complete it, either by calling close or by closing the output stream. Either of these actions will flush the output stream.

This behavior enables users to asynchronously handle the exchange outside of the `handle` method. I don't know if anyone actually uses that functionality, but it's been here forever, and I don't think we want to change it now.

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

PR Comment: https://git.openjdk.org/jdk/pull/18667#issuecomment-2066890570


More information about the net-dev mailing list