As discussed in JDK-8361462, static Semaphores are potentially unsafe if accessed during VM termination. The ZipLibrary code has a static semaphore for the ZipLibraryLoaderLock. This lock guards the initialization of the platform zip library which is done lazily when a classloader needs to open a zipped enity. The ZipLibraryLoaderLock code explicitly transitions the current JavaThread to be _thread_in_native and so it appears safepoint-safe. Consequently if a (daemon) thread happened to initiate such loading whilst termination was in process, it could access the Semaphore after it has been destroyed.
Unfortunately due to the lazy initialization, placement of the `init` call for a `DeferredStatic` is problematic.
Unfortunately due to the lazy initialization, placement of the `init` call for a `DeferredStatic` is problematic.
- caused by
-
JDK-8317951 Refactor loading of zip library to help resolve JDK-8315220
-
- Resolved
-
- relates to
-
JDK-8361462 JVM crashed with assert(ret == 0) failed: Failed to wait on semaphore
-
- In Progress
-