-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 insightful information for classloader issues #24973
Conversation
core/trino-main/src/main/java/io/trino/server/PluginClassLoader.java
Outdated
Show resolved
Hide resolved
core/trino-main/src/main/java/io/trino/server/PluginClassLoader.java
Outdated
Show resolved
Hide resolved
be18254
to
98559ce
Compare
core/trino-main/src/main/java/io/trino/server/PluginClassLoader.java
Outdated
Show resolved
Hide resolved
This saves time while diagnosing issue like: ``` tests | Caused by: java.lang.ClassNotFoundException: SPI class 'io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder' was not found in the SPI classloader, but was found in the 'delta-lake' plugin classloader tests | at io.trino.server.PluginClassLoader.loadClass(PluginClassLoader.java:108) tests | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528) tests | ... 79 more tests | Caused by: java.lang.ClassNotFoundException: io.opentelemetry.api.incubator.metrics.ExtendedDoubleHistogramBuilder tests | at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) tests | at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) tests | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528) tests | at io.trino.server.PluginClassLoader.loadClass(PluginClassLoader.java:104) tests | ... 80 more ```
98559ce
to
4886aa1
Compare
private boolean hasClassLocally(String name, boolean resolve) | ||
{ | ||
try { | ||
super.loadClass(name, resolve); |
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.
This is potentially problematic. This will have the side effects that the class may get loaded, the caller will throw an exception that may be caught by someone else, and things may start behaving in unexpected ways.
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.
This was already problematic if the class belong to an SPI_PACKAGES but couldn't be loaded through the SPI class loader. I've faced this issue recently.
This saves time while diagnosing issue like:
Description
Additional context and related issues
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.