[CORE] Avoid getting duplicate resource files for component discovery#11043
Merged
Conversation
|
Run Gluten Clickhouse CI on x86 |
Member
Author
|
@liujiayi771, could you take a look? |
Member
Author
|
@zhztheplayer, please take look and let me know if thread's context class loader is used intentionally. If yes, maybe I can just suppress the warning in this PR. |
|
Run Gluten Clickhouse CI on x86 |
Contributor
|
Thanks for fixing this confusing warning. |
zhztheplayer
approved these changes
Nov 7, 2025
| final Enumeration<URL> containerUrls; | ||
| try { | ||
| containerUrls = Thread.currentThread().getContextClassLoader().getResources(container); | ||
| containerUrls = ResourceUtil.class.getClassLoader().getResources(container); |
Member
There was a problem hiding this comment.
👍
The change itself looks reasonable, and I didn't realize context class loader could result in duplicated resources. Will find some time to debug on my end.
liujiayi771
approved these changes
Nov 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are proposed in this pull request?
It seems
Thread.currentThread().getContextClassLoader()will internally use multiple class loaders that return duplicate resource files.If Gluten fat JAR with all component files is configured for Spark, or Gluten JAR and separate component JARs are configured together for Spark, e.g.,
spark.driver.extraClassPath, I assume it should be safe to use the current class's loader to get all component files.Before the fix:
After the fix:
How was this patch tested?
CI.