cheeeee opened a new pull request, #23832: URL: https://github.com/apache/kafka/pull/23832
`SslTransportLayer.transferFrom` clears `fileChannelBuffer` before reading the next chunk of the file. When the read threw, or returned no bytes, the buffer was left cleared rather than flipped, so it still looked full of the previous chunk. If bytes had already been written in the same call the `IOException` was swallowed, and the next call sent the stale buffer as the contents of the position that could not be read: a read error on the segment never surfaced, and the client received a corrupt batch. This flips the buffer whether or not the read succeeds, so that it holds exactly what was read: nothing after a failed read. The next call then reads again, and the original `IOException` propagates. Generated-by: Claude (Anthropic) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
