On Tue, 12 Jul 2022 20:00:22 GMT, Roger Riggs <rri...@openjdk.org> wrote:
> The test `java/lang/ClassLoader/loadLibraryUnload/LoadLibraryUnloadTest.java` > Fails intermittently when expected output from a subprocess is not found. > > I suspect a race between the Cleaner that is going to call JNI_OnUnload (in > NativeLibraries.java:377) when the ClassLoader is no longer referenced and > the test code that exits as soon as it detects that the p.Class1 is no longer > referenced. > > The proposed fix is to create a canary object referenced by the native > library and released when the library is unloaded. > The Java side of the test provides the canary object and uses a WeakReference > to wait for it to be released. > When released the child process exits and the driver test will find all of > the output it expects. This pull request has now been integrated. Changeset: 0184f46b Author: Roger Riggs <rri...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/0184f46bdfe4441ea6ef28c658c6677c4c736ee9 Stats: 73 lines in 4 files changed: 51 ins; 3 del; 19 mod 8289919: [test] LoadLibraryUnloadTest.java failed with "Failed to unload native library" Reviewed-by: mchung ------------- PR: https://git.openjdk.org/jdk/pull/9474