Skip to content

Commit

Permalink
8290848: LoadLibraryUnload.java still fails with "Too few cleared Wea…
Browse files Browse the repository at this point in the history
…kReferences"

Reviewed-by: mchung, jpai
  • Loading branch information
Roger Riggs committed Jul 27, 2022
1 parent 9234624 commit c104089
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList-Xcomp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@

java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
java/lang/ref/ReferenceEnqueue.java 8284236 generic-all
java/lang/ClassLoader/loadLibraryUnload/LoadLibraryUnload.java 8290848 generic-all
java/lang/ProcessBuilder/PipelineLeaksFD.java 8290885 generic-all
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
* LoadLibraryUnload class calls ClassLoader.loadedLibrary from multiple threads
*/
/*
* @test
* The driver for this test is LoadLibraryUnloadTest.java.
*
* @bug 8266310
* @summary Loads a native library from multiple class loaders and multiple
* threads. This creates a race for loading the library. The winner
Expand All @@ -35,14 +36,12 @@
* loaded in a different class loader that won the race. The test
* checks that the loaded class is GC'ed, that means the class loader
* is GC'ed and the native library is unloaded.
* @library /test/lib
* @build LoadLibraryUnload p.Class1
* @run main/othervm/native -Xcheck:jni LoadLibraryUnload
*/
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;

import java.lang.*;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.reflect.*;
import java.lang.ref.WeakReference;
Expand Down Expand Up @@ -161,7 +160,6 @@ public static void main(String[] args) throws Exception {
threads = null;
canary = null;
exceptions.clear();

// Wait for the canary for each of the libraries to be GC'd
// before exiting the test.
for (int i = 0; i < LOADER_COUNT; i++) {
Expand All @@ -172,5 +170,7 @@ public static void main(String[] args) throws Exception {
Asserts.fail("Too few cleared WeakReferences");
}
}
// Ensure the WeakReferences are strongly referenced until they can be dequeued
Reference.reachabilityFence(wCanary);
}
}

0 comments on commit c104089

Please sign in to comment.