RFR 8247966: runtime/logging/loadLibraryTest/LoadLibraryTest.java failed "RuntimeException: 'Unloaded library with handle' missing from stdout/stderr"

Harold Seigel harold.seigel at oracle.com
Tue Jun 23 17:45:25 UTC 2020


Please review this small change to fix logging test 
LoadLibraryTest.java.  The fix prevents the main thread from terminating 
before the Cleaner thread has had a chance to unload native library 
"LoadLibraryClass".  It does this in the following way.

Java has a restriction that a native library can only be loaded by one 
class loader.  The JDK is able to implement this restriction by 
synchronizing access to loading and unloading native libraries.  (See 
synchronization on static object loadedLibraryNames in 
jdk/internal/loader/NativeLibraries.java.) So, the code in the test that 
checks if the class that loaded the native library was unloaded, was 
changed to try to load the native library.  If it was able to load the 
native library then it knows that the Cleaner thread has finished 
unloading the library.  If not, it waits a little and checks again in a 
polling loop.

Open Webrev: 

JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8247966

The modified test was tested on Linux-x64, Linux-aarch64, Windows, and 
Mac OS X and run 500+ times using Window-x64 fastdebug builds.

Thanks, Harold

More information about the hotspot-runtime-dev mailing list