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

Harold Seigel harold.seigel at oracle.com
Wed Jun 24 12:08:32 UTC 2020

Thanks David!


On 6/24/2020 12:17 AM, David Holmes wrote:
> Hi Harold,
> This looks good. I had envisaged a simple sleep to keep the main 
> thread around for a few seconds longer, but actually being able to 
> detect the library must have been unloaded is much neater! :)
> Thanks,
> David
> On 24/06/2020 3:45 am, Harold Seigel wrote:
>> Hi,
>> 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: 
>> http://cr.openjdk.java.net/~hseigel/bug_8247966/webrev/index.html
>> 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