Integrated: 8338452: (dc) DatagramChannelImpl.blockingReceive with timeout may block indefinitely if all datagrams blocked by SecurityManager

Alan Bateman alanb at openjdk.org
Mon Aug 19 12:59:55 UTC 2024


On Fri, 16 Aug 2024 08:27:41 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> A small regression from JDK-8338142 that arises with DatagramSocket.receive with a timeout and a SecurityManager, or when using a really small timeout (like 1ms). In these cases, the remaining time may be computed as negative which causes the receive to block indefinitely waiting for a datagram. 
> 
> Timed receive requires timeout adjustment in two places (outer and inner loops). This complexity will go away when the SecurityManager implementation is removed. For now, I've kept the changes as small as possible so that the adjustment in the outer loop is only done when the datagram is denied by the security manager.
> 
> The test java/net/DatagramSocket/TimeoutWithSM.java exercises this code. It has failed at least once since JDK-8338142 was integrated.

This pull request has now been integrated.

Changeset: 2766b09e
Author:    Alan Bateman <alanb at openjdk.org>
Committer: Jaikiran Pai <jpai at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2766b09e29d7c1c31fdef20f016a181eedb2d429
Stats:     15 lines in 1 file changed: 11 ins; 4 del; 0 mod

8338452: (dc) DatagramChannelImpl.blockingReceive with timeout may block indefinitely if all datagrams blocked by SecurityManager

Reviewed-by: dfuchs

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

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


More information about the nio-dev mailing list