You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "JoegenUSTC (via GitHub)" <gi...@apache.org> on 2026/06/17 03:27:23 UTC
[PR] [#11704] fix(core): add org.apache.gravitino.hive.* prefix to IsolatedClassLoader.isCatalogClass() [gravitino]
JoegenUSTC opened a new pull request, #11705:
URL: https://github.com/apache/gravitino/pull/11705
### What changes were proposed in this pull request?
Add `org.apache.gravitino.hive.` as a recognized catalog class prefix in
`IsolatedClassLoader.isCatalogClass()`, and add unit tests to cover the
classification of all hive-related packages.
### Why are the changes needed?
Fix: #11704
PR #9460 refactored the Hive catalog and moved classes such as
`HiveExceptionConverter` from `org.apache.gravitino.catalog.hive.*` to
`org.apache.gravitino.hive.*`. However, `isCatalogClass()` was not updated,
so classes under `org.apache.gravitino.hive.*` are incorrectly treated as
shared classes and delegated to the server classloader.
In certain classloader initialization timing windows, the server classloader
becomes the defining classloader for `HiveExceptionConverter`. Its
compiler-generated synthetic class `$1` (produced by `switch`-on-enum) is
then requested from the server classloader, which cannot find it in the server
classpath. **The JVM permanently caches this load failure for the process
lifetime**, causing all subsequent calls to throw `NoClassDefFoundError` until
the process is restarted.
### Does this PR introduce _any_ user-facing change?
No. This is an internal classloader fix with no API or behavior change.
### How was this patch tested?
Added `TestIsolatedClassLoader` with four test methods covering:
- `org.apache.gravitino.hive.*` classes are recognized as catalog classes
- `org.apache.gravitino.catalog.hive.*` classes continue to be recognized
- Other catalog packages (`lakehouse`, `jdbc`, `kafka`, etc.) are unaffected
- Server-side shared classes are correctly excluded
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11704] fix(core): add org.apache.gravitino.hive.* prefix to IsolatedClassLoader.isCatalogClass() [gravitino]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11705:
URL: https://github.com/apache/gravitino/pull/11705#issuecomment-4727095949
<!-- coverage-report -->
### Code Coverage Report
|Overall Project|67.11% **`-0.01%`**|:green_circle:|
|:-|:-|:-:|
|Files changed|56.57%|:red_circle:|
<br>
|Module|Coverage||
|:-|:-|:-:|
|aliyun|1.72%|:red_circle:|
|api|46.82%|:green_circle:|
|authorization-common|85.96%|:green_circle:|
|aws|3.66%|:red_circle:|
|azure|2.47%|:red_circle:|
|catalog-common|10.4%|:red_circle:|
|catalog-fileset|80.23%|:green_circle:|
|catalog-glue|66.91%|:green_circle:|
|catalog-hive|79.44%|:green_circle:|
|catalog-jdbc-clickhouse|80.02%|:green_circle:|
|catalog-jdbc-common|44.22%|:green_circle:|
|catalog-jdbc-doris|80.28%|:green_circle:|
|catalog-jdbc-hologres|54.03%|:green_circle:|
|catalog-jdbc-mysql|79.23%|:green_circle:|
|catalog-jdbc-oceanbase|78.38%|:green_circle:|
|catalog-jdbc-postgresql|82.29%|:green_circle:|
|catalog-jdbc-starrocks|78.51%|:green_circle:|
|catalog-kafka|77.01%|:green_circle:|
|catalog-lakehouse-generic|58.53%|:green_circle:|
|catalog-lakehouse-hudi|79.1%|:green_circle:|
|catalog-lakehouse-iceberg|85.94%|:green_circle:|
|catalog-lakehouse-paimon|82.14%|:green_circle:|
|catalog-model|77.72%|:green_circle:|
|cli|44.51%|:green_circle:|
|client-java|78.01%|:green_circle:|
|common|50.17%|:green_circle:|
|core|82.48% **`-0.1%`**|:green_circle:|
|filesystem-hadoop3|77.27%|:green_circle:|
|flink|0.0%|:red_circle:|
|flink-common|46.84%|:green_circle:|
|flink-runtime|0.0%|:red_circle:|
|gcp|14.12%|:red_circle:|
|hadoop-common|10.88%|:red_circle:|
|hive-metastore-common|53.77%|:green_circle:|
|iceberg-common|58.15%|:green_circle:|
|iceberg-rest-server|73.98%|:green_circle:|
|idp-basic|86.18%|:green_circle:|
|integration-test-common|0.0%|:red_circle:|
|jobs|66.17%|:green_circle:|
|lance-common|20.83%|:red_circle:|
|lance-rest-server|60.13%|:green_circle:|
|lineage|53.02%|:green_circle:|
|optimizer|82.87%|:green_circle:|
|optimizer-api|21.95%|:red_circle:|
|server|85.96%|:green_circle:|
|server-common|74.21%|:green_circle:|
|spark|28.57%|:red_circle:|
|spark-common|41.66%|:green_circle:|
|trino-connector|40.13%|:green_circle:|
<details>
<summary>Files</summary>
|Module|File|Coverage||
|:-|:-|:-|:-:|
|core|[IsolatedClassLoader.java](https://github.com/JoegenUSTC/gravitino/blob/56c2394af72e7982b0faac2be2e0a0930ddec601/core/src/main/java/org/apache/gravitino/utils/IsolatedClassLoader.java)|56.57%|:red_circle:|
</details>
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11704] fix(core): add org.apache.gravitino.hive.* prefix to IsolatedClassLoader.isCatalogClass() [gravitino]
Posted by "JoegenUSTC (via GitHub)" <gi...@apache.org>.
JoegenUSTC commented on code in PR #11705:
URL: https://github.com/apache/gravitino/pull/11705#discussion_r3426806415
##########
core/src/main/java/org/apache/gravitino/utils/IsolatedClassLoader.java:
##########
@@ -240,16 +240,23 @@ private boolean isSharedClass(String name) {
* @return true if the class is a catalog class, false otherwise.
*/
private boolean isCatalogClass(String name) {
- return name.startsWith("org.apache.gravitino.catalog")
- && (name.startsWith("org.apache.gravitino.catalog.hive.")
- || name.startsWith("org.apache.gravitino.catalog.lakehouse.")
- || name.startsWith("org.apache.gravitino.catalog.jdbc.")
- || name.startsWith("org.apache.gravitino.catalog.mysql.")
- || name.startsWith("org.apache.gravitino.catalog.postgresql.")
- || name.startsWith("org.apache.gravitino.catalog.doris.")
- || name.startsWith("org.apache.gravitino.catalog.fileset.")
- || name.startsWith("org.apache.gravitino.catalog.model.")
- || name.startsWith("org.apache.gravitino.catalog.kafka."));
+ // org.apache.gravitino.hive.* covers classes moved to the shared hive-metastore-common
+ // module by the HiveClient refactoring (e.g. HiveExceptionConverter). Without this prefix
+ // those classes are treated as shared and loaded by the server classloader; their
+ // compiler-generated synthetic classes (e.g. $1 from switch-on-enum) are then requested
+ // from the server classloader which cannot find them, causing a permanent
+ // NoClassDefFoundError that is cached by the JVM for the lifetime of the process.
+ return name.startsWith("org.apache.gravitino.hive.")
+ || (name.startsWith("org.apache.gravitino.catalog")
+ && (name.startsWith("org.apache.gravitino.catalog.hive.")
Review Comment:
@diqiu50
Thanks for the review! You're right — the outer name.startsWith("org.apache.gravitino.catalog") is indeed redundant since every inner sub-prefix (e.g. org.apache.gravitino.catalog.hive.) already implies it. I've removed the wrapping AND and flattened the conditions into a straightforward OR chain. The semantics remain identical.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11704] fix(core): add org.apache.gravitino.hive.* prefix to IsolatedClassLoader.isCatalogClass() [gravitino]
Posted by "mchades (via GitHub)" <gi...@apache.org>.
mchades merged PR #11705:
URL: https://github.com/apache/gravitino/pull/11705
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#11704] fix(core): add org.apache.gravitino.hive.* prefix to IsolatedClassLoader.isCatalogClass() [gravitino]
Posted by "diqiu50 (via GitHub)" <gi...@apache.org>.
diqiu50 commented on code in PR #11705:
URL: https://github.com/apache/gravitino/pull/11705#discussion_r3426036712
##########
core/src/main/java/org/apache/gravitino/utils/IsolatedClassLoader.java:
##########
@@ -240,16 +240,23 @@ private boolean isSharedClass(String name) {
* @return true if the class is a catalog class, false otherwise.
*/
private boolean isCatalogClass(String name) {
- return name.startsWith("org.apache.gravitino.catalog")
- && (name.startsWith("org.apache.gravitino.catalog.hive.")
- || name.startsWith("org.apache.gravitino.catalog.lakehouse.")
- || name.startsWith("org.apache.gravitino.catalog.jdbc.")
- || name.startsWith("org.apache.gravitino.catalog.mysql.")
- || name.startsWith("org.apache.gravitino.catalog.postgresql.")
- || name.startsWith("org.apache.gravitino.catalog.doris.")
- || name.startsWith("org.apache.gravitino.catalog.fileset.")
- || name.startsWith("org.apache.gravitino.catalog.model.")
- || name.startsWith("org.apache.gravitino.catalog.kafka."));
+ // org.apache.gravitino.hive.* covers classes moved to the shared hive-metastore-common
+ // module by the HiveClient refactoring (e.g. HiveExceptionConverter). Without this prefix
+ // those classes are treated as shared and loaded by the server classloader; their
+ // compiler-generated synthetic classes (e.g. $1 from switch-on-enum) are then requested
+ // from the server classloader which cannot find them, causing a permanent
+ // NoClassDefFoundError that is cached by the JVM for the lifetime of the process.
+ return name.startsWith("org.apache.gravitino.hive.")
+ || (name.startsWith("org.apache.gravitino.catalog")
+ && (name.startsWith("org.apache.gravitino.catalog.hive.")
Review Comment:
The condition `name.startsWith("org.apache.gravitino.catalog")` is redundant.
Removing it would make the code more readable.
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org