-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a better error message for failed library loads on jdk17+ #17374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description and commit message should be updated to reflect that this applies to jdk11+.
It only applies to jdk17+. jdk17 changed how JNI libraries are loaded, making this change necessary. jdk11 uses OpenJ9 to load libraries, which already provides the better error messages. |
Pushed a change to address the other review comments. |
/* jdk17+ calls JVM_LoadLibrary with decorated library names. If the following is done | ||
* then it overwrites the real error with a failure to load "liblib<name>.so.so". | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we don't expect this function to be used at all prior to jdk17; I'll plan to create a follow-up PR that simply asserts that and remove unnecessary code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful, I only checked jdk11.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't be easy to check IBM Java 8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use defined(OPENJ9_BUILD)
to avoid impacting IBM Java 8 builds.
Jenkins compile win32 jdk8 |
Jenkins compile alinux64 jdk17 |
I'm not sure whether to expect the jdk8 build to fail because |
615a5d7
to
007c7eb
Compare
JVM_LoadLibrary() is used to load JNI libraries from jdk17. Issue eclipse-openj9#17285 Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
Jenkins compile win32 jdk8 |
Jenkins compile amac jdk17 |
JVM_LoadLibrary() is used to load JNI libraries from jdk17.
Fixes #17285
The library being loaded needs to exist to get the better message. With this change you get an error message to explain why the load failed.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to load library ("/home/pete/openj9-openjdk-jdk17/build/linux-x86_64-server-release/images/jdk/lib/libabc.so") /home/pete/openj9-openjdk-jdk17/build/linux-x86_64-server-release/images/jdk/lib/libabc.so: file too short
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to load library ("/home/pete/openj9-openjdk-jdk17/build/linux-x86_64-server-release/images/jdk/lib/libabc.so") /home/pete/openj9-openjdk-jdk17/build/linux-x86_64-server-release/images/jdk/lib/libabc.so: invalid ELF header