isClassLoadable answers false on threads without a context classloader
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start at ReflectUtils.isClassLoadable and inspect how its default thread context classloader reaches DynClasses.builder().loader(null). Reproduce the probe with a null context classloader, then verify that an application class and the optional SLF4J or MySQL integrations are detected through a real defining loader.
Written by the indexing model from the issue text.
Description
Describe the bug
ReflectUtils.isClassLoadable defaults its loader to the thread context classloader:
def isClassLoadable(
className: String,
cl: ClassLoader = Thread.currentThread().getContextClassLoader): Boolean = ...
On a thread whose context classloader is null, DynClasses.builder().loader(null) resolves the name with Class.forName(name, true, null), which delegates to the bootstrap loader. The bootstrap loader sees only JDK classes, so the probe answers false for every application class, including Kyuubi's own, even when that class is loadable through the loader that defined ReflectUtils.
A thread can carry a null context classloader in embedded scenarios: a host that starts the JVM through the JNI invocation API without setting one, or a container framework that clears it. Logging and JDBCMetadataStore probe optional integrations through this helper, so on such a thread the SLF4J bridge or the MySQL driver would be reported as absent when it is present.
Spark's own Utils.classForName / getContextOrSparkClassLoader guard against this by falling back to a real loader instead of trusting a null context loader.
Affects Version(s)
master (1.13.0-SNAPSHOT), and earlier releases carrying kyuubi-util-scala.
Are you willing to submit PR?
Yes.
- Dominant language
- Scala
- Stars
- 2.4k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/kyuubi
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
kind:feature priority:major
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
kind:bug priority:major
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
kind:feature priority:major
Difficulty 5/5 Over a week Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ergoplatform/ergodocs#614 ·
-
area:ci enhancement requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion-comet#6078 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
[VL] madvise(WILLNEED) call fails in MmapFileStream because of wrong calculation of fetching length Openbug triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chipsalliance/rocket-chip#3831 ·