8022594: Potential deadlock in <clinit> of sun.nio.ch.Util/IOUtil

Alan Bateman Alan.Bateman at oracle.com
Mon Aug 26 01:54:06 PDT 2013


Jeremy Manson recently reported a sighting of a deadlock at startup in 
the static initializers that are involved in loading libnio/equivalent [1].

Digging through the JDK 1.4/1.5 era history then it seems there were 
other issues that lead to the current implementation. Looking at now and 
since sun.nio.ch.Util doesn't have any native methods then the simplest 
thing to do (but not the only solution) is to move the loading of the 
native libraries to IOUtil. That eliminates the need for the additional 
locking.

The webrev with the changes is here:

http://cr.openjdk.java.net/~alanb/8022594/webrev/

The patch does not include a test as this is a deadlock at startup that 
just isn't easy to reproduce (at least not on the systems that I tried).

-Alan

[1] 
http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-August/019630.html


More information about the nio-dev mailing list