RFR: 8312166: (dc) DatagramChannel's socket adaptor does not release carrier thread when blocking in receive

Alan Bateman alanb at openjdk.org
Tue Jul 18 14:11:10 UTC 2023


On Tue, 18 Jul 2023 13:38:12 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> The one issue that I could notice was a potential data loss when you read incoming data into the `ByteBuffer` and then while transferring to a `DatagramPacket` can potentially transfer lesser than the read data if the `bufLength` of the `DatagramPacket` has changed. 

Such code would be very broken. Even today, if code were to call setData to replace the byte[] while receive is blocked then it will do so once receive has completed. Any code that processes the datagram after receive may see the the new byte[] rather than the byte[] with the datagram.

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

PR Comment: https://git.openjdk.org/jdk/pull/14901#issuecomment-1640301463


More information about the nio-dev mailing list