You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2026/06/29 11:52:11 UTC
[PR] [GLUTEN-12392][CORE] Return early in JniLibLoader.loadAndCreateLink() when the library is already loaded [gluten]
LuciferYang opened a new pull request, #12393:
URL: https://github.com/apache/gluten/pull/12393
### What changes were proposed in this pull request? `JniLibLoader.loadAndCreateLink()` has an early-skip log line for libraries that this instance has already loaded, but the branch forgets to `return` — so `moveToWorkDir` and the symlink rebuild ran anyway. The sibling `load()` does `return;` in the same branch, so the two methods diverged. This PR adds the missing `return;` so the method mirrors `load()`, and adds a small Javadoc on `loadAndCreateLink` pinning the contract ("same as load, plus a symlink; returns immediately if already loaded") so the behaviour is documented rather than only enforced by code-shape symmetry. ### Why are the changes needed? Closes #12392. Because `System.load` itself is deduped via `LOADED_LIBRARY_PATHS`, the bug does not cause a double native load — but on every repeat call the library still gets re-extracted to the work directory and the symlink delete+recreated. That is wasted I/O at best and a delete/recreate race against any concurrent re
ader at worst. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? `mvn -pl gluten-core -Pspark-3.5 spotless:check` passes. `mvn -pl gluten-core -Pspark-3.5 -Dtest=JniLibLoaderTest test` — the existing `gluten-core` Java tests still pass. The fix is a 1-line behavioural alignment with `load()` (already covered by usage); a dedicated reflection-based test was considered but rejected to avoid coupling tests to the private `loadedLibraries` field. Javadoc was added instead to document the contract.
--
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@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-12392][CORE] Return early in JniLibLoader.loadAndCreateLink() when the library is already loaded [gluten]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #12393:
URL: https://github.com/apache/gluten/pull/12393#issuecomment-4832200484
Run Gluten Clickhouse CI on x86
--
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@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org
Re: [PR] [GLUTEN-12392][CORE] Return early in JniLibLoader.loadAndCreateLink() when the library is already loaded [gluten]
Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on code in PR #12393:
URL: https://github.com/apache/gluten/pull/12393#discussion_r3491475290
##########
gluten-core/src/main/java/org/apache/gluten/jni/JniLibLoader.java:
##########
@@ -90,10 +90,16 @@ public synchronized void load(String libPath) {
}
}
+ /**
+ * Same contract as {@link #load(String)}, with the addition of creating a symbolic link named
+ * {@code linkName} in {@code workDir} pointing at the extracted library. Returns immediately if
+ * {@code libPath} was already loaded by this instance.
+ */
public synchronized void loadAndCreateLink(String libPath, String linkName) {
try {
if (loadedLibraries.contains(libPath)) {
LOG.debug("Library {} has already been loaded, skipping", libPath);
+ return;
Review Comment:
cc @jackylee-ch , a minor fix
--
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@gluten.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org