You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2026/09/10 16:45:48 UTC
[PR] [KYUUBI #7723][UTIL] Answer false from isClassLoadable when the class fails to link or initialize [kyuubi]
LuciferYang opened a new pull request, #7724:
URL: https://github.com/apache/kyuubi/pull/7724
### Why are the changes needed?
Closes #7723.
`ReflectUtils.isClassLoadable` wrapped its `DynClasses` probe in `scala.util.Try`, which catches only `NonFatal`. The probe resolves the name with `Class.forName(className, true, loader)`, so a class that is present but fails to link or initialize raises a `LinkageError` (`NoClassDefFoundError`, `ExceptionInInitializerError`) rather than a `ClassNotFoundException`. `LinkageError` is not `NonFatal`, so it escaped the probe and crashed the caller instead of answering `false`.
This replaces the `Try` with an explicit `try`/`catch` that answers `false` on `ClassNotFoundException` and `LinkageError`. The two call sites (`Logging` probing the SLF4J bridge, `JDBCMetadataStore` probing the MySQL driver) read the result as a boolean and are only made safer. `OutOfMemoryError`/`StackOverflowError` are `VirtualMachineError`, not `LinkageError`, so they stay fatal exactly as they did under `Try`.
### How was this patch tested?
Added a `ReflectUtilsSuite` case that probes a top-level object whose static initializer throws, by its binary name, and asserts `isClassLoadable` returns `false`. Reverting the production change makes the suite abort as the `ExceptionInInitializerError` escapes, which pins the regression.
```
build/mvn test -pl kyuubi-util-scala -am
build/mvn scalastyle:check spotless:check -pl kyuubi-util-scala -am
```
Module green on Zulu 17.0.18 (22/22), scalastyle 0 errors, spotless clean.
### Was this patch assisted by generative AI tooling?
Assisted-by: Claude Opus 4.8
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #7723][UTIL] Answer false from isClassLoadable when the class fails to link or initialize [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #7724: [KYUUBI #7723][UTIL] Answer false from isClassLoadable when the class fails to link or initialize
URL: https://github.com/apache/kyuubi/pull/7724
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #7723][UTIL] Answer false from isClassLoadable when the class fails to link or initialize [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #7724:
URL: https://github.com/apache/kyuubi/pull/7724#issuecomment-5751079070
**Merge Summary:**
- merged into master https://github.com/apache/kyuubi/commit/c002a42b3b8cb649e892e38b58fe93e0a29df8e9
- merged into branch-1.12 https://github.com/apache/kyuubi/commit/5b3a10d2311dd573114c3b2956f1ef4c8aa6cf82
- merged into branch-1.11 https://github.com/apache/kyuubi/commit/6eafef5bdec0052126316e9c0808b9d63fe03685
- merged into branch-1.10 https://github.com/apache/kyuubi/commit/a1ec06300d878de8a4381242b9044317c6ae1081
*Posted by `merge_kyuubi_pr.py`*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #7723][UTIL] Answer false from isClassLoadable when the class fails to link or initialize [kyuubi]
Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #7724:
URL: https://github.com/apache/kyuubi/pull/7724#issuecomment-5747792374
can we merge this one? @pan3793
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [KYUUBI #7723][UTIL] Answer false from isClassLoadable when the class fails to link or initialize [kyuubi]
Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #7724:
URL: https://github.com/apache/kyuubi/pull/7724#issuecomment-5754704276
Thank you @pan3793
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org