You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When in a complex classpath environment (such as the FabricMC KnotClassLoader which loads nested jar files), the check for JDK-8195129 causes the native library in question to be loaded during the "extraction" phase and before the "loading" phase. Crucially, the library isn't even loaded with the supplied class loader, it's loaded with the class loader of the SharedLibraryLoader class.
This has the effect of throwing an UnsatisfiedLinkError during the "loading" phase since the library has already been loaded.
I propose ideally the check for JDK-8195129 should search the string for Unicode characters. If that isn't possible, then it should at least try to load the library using the class loader supplied to SharedLibraryLoader::load.
The text was updated successfully, but these errors were encountered:
magneticflux-
changed the title
The check for JDK-8195129 can cause a library to be prematurely/duplicately loaded
The check for JDK-8195129 can cause a library to be prematurely/duplicately loaded in a different ClassLoaderMay 3, 2021
I tried to be clever about this and avoid System.load completely, but it became too involved. In the end, it's a JVM bug and the implementation details may change in the future, so the only way to be sure is to actually call System.load. The fix propagates the lambda passed to Library.loadSystem down to the SharedLibraryLoader, so the call should now happen in the correct ClassLoader.
Please try the next 3.3.0 snapshot and let me know how it works.
Environment
3.2.2
10
1.8.0_292 AdoptOpenJDK
Windows
core
Description
When in a complex classpath environment (such as the FabricMC
KnotClassLoader
which loads nested jar files), the check for JDK-8195129 causes the native library in question to be loaded during the "extraction" phase and before the "loading" phase. Crucially, the library isn't even loaded with the supplied class loader, it's loaded with the class loader of theSharedLibraryLoader
class.This has the effect of throwing an
UnsatisfiedLinkError
during the "loading" phase since the library has already been loaded.The check in question:
lwjgl3/modules/lwjgl/core/src/main/java/org/lwjgl/system/SharedLibraryLoader.java
Lines 279 to 286 in e4a6cc8
I propose ideally the check for JDK-8195129 should search the string for Unicode characters. If that isn't possible, then it should at least try to load the library using the class loader supplied to
SharedLibraryLoader::load
.The text was updated successfully, but these errors were encountered: