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
JDK-8293659: Improve UnsatisfiedLinkError error message to include dlopen error details #10286
Conversation
|
Webrevs
|
|
||
// If the file exists but fails to load, UnsatisfiedLinkException thrown by the VM | ||
// will include the error message from dlopen to provide diagnostic information | ||
return fileExists; |
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.
Can drop the fileExists
variable and simply return AccessController.doPrivileged(....);
Otherwise, looks good.
Adding the background and details for this review: The For this issue, a library to be loaded exists. A simple fix is to call |
Hi Mandy, thanks for the comment and the suggestion above. I adjusted throwExceptionIfFail. |
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.
Looks good to me. Thanks for taking this.
@MBaesken This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 73 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
Hi @mlchung, I tried to understand this, and your fix for JDK-8275703 (#6127). What I don't understand is why we suppressed the exception in JVM_LoadLibrary in the first place. So, in Big Sur dlopen could succeed if the library is not present in the file system. Therefore we have to omit the file exists check before attempting to dlopen. That makes sense. Then we attempt to load the library, dive into JVM_LoadLibrary->os::dll_load(), and do a dlopen(), which could succeed or fail. If it succeeds, all is well. If it fails, os::dll_load() just returns dlerror() to JVM_LoadLibrary, which packs the error string into an exception and throws it. But why did we have to prevent the exception in JVM_LoadLibrary at that point? As it is now, we don't get error details on systems with a dynamic loader cache, since we throw away the dlerror output? |
Hi Thomas, I think previously (before supporting the macOS dl-cache) we did not even attempt to call JVM_LoadLibrary when the file was not present. I asked myself the same thing you mentioned , Mandy had this remark on the topic : |
If you load a library via If loading a library via The case when |
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.
Changes look good to me.
/integrate |
Going to push as commit da4fdfb.
Your commit was automatically rebased without conflicts. |
When trying to load a x64 lib on macOS aarch64 one got previously this detailed message before JDK-8275703:
java.lang.UnsatisfiedLinkError: /testing/jco3/macOsx64/libsapjco3.dylib: dlopen(/testing/jco3/macOsx64/libsapjco3.dylib, 1): no suitable image found. Did find:
/testing/jco3/macOsx64/libsapjco3.dylib: mach-o, but wrong architecture
/testing/jco3/macOsx64/libsapjco3.dylib: mach-o, but wrong architecture [in thread "main"]
After JDK-8275703, the error message does not include the details:
java.lang.UnsatisfiedLinkError: Can't load library: /testing/jco3/macOsx64/libsapjco3.dylib [in thread "main"]
The error details are useful to help diagnosing user's error like mismatched target architecture.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10286/head:pull/10286
$ git checkout pull/10286
Update a local copy of the PR:
$ git checkout pull/10286
$ git pull https://git.openjdk.org/jdk pull/10286/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10286
View PR using the GUI difftool:
$ git pr show -t 10286
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10286.diff