yuqi1129 commented on code in PR #10480:
URL: https://github.com/apache/gravitino/pull/10480#discussion_r2999599631
##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -251,7 +290,22 @@ public void close() {
LOG.warn("Failed to close catalog", e);
}
- classLoader.close();
+ if ((pool == null) != (poolEntry == null)) {
+ // This state should never occur. Prefer leaking one ClassLoader over
destroying a
+ // ClassLoader that may still be shared by other catalogs through the
pool.
+ LOG.warn(
+ "Inconsistent state: pool={}, poolEntry={}. Skipping cleanup to
avoid corruption.",
+ pool,
+ poolEntry);
+ return;
+ }
+
+ if (pool != null && poolEntry != null) {
Review Comment:
`poolEntry != null` should always true if the code goes here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]