LuciferYang opened a new issue, #12392:
URL: https://github.com/apache/gluten/issues/12392

   ### Describe the bug
   
   `JniLibLoader.loadAndCreateLink()` has an early-skip check for libraries that
   this instance has already loaded, but the branch forgets to `return` — so the
   extraction + symlink work runs anyway:
   
   ```java
   public synchronized void loadAndCreateLink(String libPath, String linkName) {
     try {
       if (loadedLibraries.contains(libPath)) {
         LOG.debug("Library {} has already been loaded, skipping", libPath);
         // <-- no return here
       }
       File file = moveToWorkDir(workDir, libPath);    // delete + re-extract
       loadWithLink(file.getAbsolutePath(), linkName); // delete + recreate 
symlink
       ...
     }
   }
   ```
   
   The sibling `load()` (a few lines above) does `return;` in the same branch, 
so
   the two methods diverge.
   
   Because `System.load` itself is deduped further down via
   `LOADED_LIBRARY_PATHS`, the bug does not cause a double native load — the
   visible effect is wasted I/O on every repeated call plus a delete/recreate
   race against any concurrent reader of the work directory.
   
   Discovered while reviewing the L1 foundation utilities in `gluten-core`.
   
   ### Expected behavior
   
   `loadAndCreateLink()` should mirror `load()`: when `loadedLibraries` already
   contains the entry, log and return immediately — no `moveToWorkDir`, no
   symlink rebuild.
   
   Fix is one line; happy to send a PR.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to