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

Jaikiran Pai jpai 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.

I see that Alan has delegated this integration and the PR has been approved. I also checked that tier2 testing was done against this change in the CI. I will go ahead and integrate this now.

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

PR Comment: https://git.openjdk.org/jdk/pull/20609#issuecomment-2296513946


More information about the nio-dev mailing list