Skip to content
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

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Feb 10, 2025

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

Description

Additional context and related issues

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.

@wendigo wendigo force-pushed the serafin/debug-class-loader branch from be18254 to 98559ce Compare February 10, 2025 12:47
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
```
@wendigo wendigo force-pushed the serafin/debug-class-loader branch from 98559ce to 4886aa1 Compare February 10, 2025 14:33
@wendigo wendigo merged commit 5a499e6 into trinodb:master Feb 10, 2025
5 of 68 checks passed
@github-actions github-actions bot added this to the 471 milestone Feb 10, 2025
private boolean hasClassLocally(String name, boolean resolve)
{
try {
super.loadClass(name, resolve);
Copy link
Member

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.

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants