RFR: 8299015: Ensure that HttpResponse.BodySubscribers.ofFile writes all bytes

Daniel Fuchs dfuchs at openjdk.org
Mon Dec 19 15:57:51 UTC 2022


On Mon, 19 Dec 2022 14:02:41 GMT, Chris Hegarty <chegar at openjdk.org> wrote:

> The implementation of `BodySubscribers.ofFile` does not correctly handle the case of a short gathering write. The write should be retried until all the bytes have been written to the underlying file.
> 
> This is generally not an issue that would occur very frequently, since the `IOV_MAX` is commonly 1024 on Mac/Linux, and 16 on Windows. However, it is clearly a bug, and should be fixed.

Hey @ChrisHegarty glad to see you back :-)
The proposed changes look reasonable. I will run them in the CI and approve if the tests come back clean.

I am a little puzzled by the description of the issue however as AFAIR the SocketTube will not produce a list that contains more than three ByteBuffers. So unless I'm mistaken the 1024 limit in one onNext() call should never be reached (at least when invoked by the HttpClient stack). I agree this is a bug though, and it should be fixed.

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

PR: https://git.openjdk.org/jdk/pull/11722


More information about the net-dev mailing list