-
Couldn't load subscription status.
- Fork 1.8k
[GR-38674] Fix JFR-related UnsatisfiedLinkErrors. #11203
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
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.
Is the main change here recomputing JVMSupport.notAvailable so that the JDK-level JFR code knows that JFR is not supported? Then, in case JFR calls to the VM are somehow still made, you've kept the substitutions and now throw a descriptive error instead of UnsatisfiedLinkError?
| } | ||
| return SubstrateJVM.getThreadId(t); | ||
| } | ||
|
|
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.
Why are methods like Target_jdk_jfr_internal_JVM#getAllEventClasses() and Target_jdk_jfr_internal_JVM#getTicksFrequency() not guarded by HasJfrSupport.get()? Will this make JFR-related classes reachable even though users won't actually be able to use JFR?
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.
Those methods don't pull in anything problematic, so we can support them trivially even if the JFR support is disabled (e.g., Target_jdk_jfr_internal_JVM#getAllEventClasses will just return an empty list if the JFR support is disabled).
Yes, |
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.
Thank you!
By default, JFR support is disabled in Native Image. If any JFR functionality is accessed at run-time, Native Image throws a
java.lang.UnsatisfiedLinkErrorat the moment, e.g.:This PR fixes that by ensuring that certain JFR substitutions are used even if JFR support is disabled.