Skip to content

Conversation

@ldematte
Copy link
Contributor

@ldematte ldematte commented Sep 5, 2025

This PR adds some precise and readable messages specifying why a CuVSProvider is unsupported (it throws UnsupportedOperationException), to help with diagnosing cuvs-java startup issues.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Sep 5, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ldematte. LGTM

@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Sep 5, 2025
@mythrocks
Copy link
Contributor

I'm 👍 too on this, and with #1315.

I'm waiting on 1296's final approval, to queue these up.

@mythrocks mythrocks changed the title [Review][Java] Add reason(s) to UnsupportedProvider/UnsupportedOperationExceptions [Java] Add reason(s) to UnsupportedProvider/UnsupportedOperationExceptions Sep 10, 2025
@mythrocks
Copy link
Contributor

/ok to test e7c7640

@mythrocks
Copy link
Contributor

/merge

@rapids-bot rapids-bot bot merged commit 792730c into rapidsai:branch-25.10 Sep 11, 2025
84 checks passed
rapids-bot bot pushed a commit that referenced this pull request Sep 14, 2025
This PR extends #1314 to add version check (version reported by libcuvs vs. cuvs-java build version)

It replaces #1315 which was already reviewed and approved, but got closed before I could rebase it.

Authors:
  - Lorenzo Dematté (https://github.com/ldematte)

Approvers:
  - MithunR (https://github.com/mythrocks)

URL: #1327
rapids-bot bot pushed a commit that referenced this pull request Sep 15, 2025
…to UnsupportedProvider/UnsupportedOperationExceptions (#1316)

This PR further extends #1296 and #1314 to give meaningful error messages in case libcuvs fails to load.

The `jextract` generated bindings we use in cuvs-java use `SymbolLookup#libraryLookup` to load the `cuvs_c` dynamic library; this uses `RawNativeLibraries#load` (see https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libjava/RawNativeLibraries.c#L58); `RawNativeLibraries#load` in turn calls `JVM_LoadLibrary`. 

`JVM_LoadLibrary` does a good job to put together a good error message (e.g. calling `dlerror`, trying to locate and inspect the file for platform mismatch, etc. Unfortunately, `RawNativeLibraries#load` calls it passing false to the `throwException` parameter, which means that the detailed error messages are not surfaced.

This PR follows the pattern introduced in #1296 and preloads libcuvs (and dependencies) using `JVM_LoadLibrary` directly with `throwException` true; preloading it will also cause the OS to look for and load all dependencies. 
In case of error we can see what's broken in better detail; e.g. if `libcuvs_c.so` is present, but `librmm.so` is missing:

```
java.lang.UnsupportedOperationException: cannot create JDKProvider: libcuvs_c.so: librmm.so: cannot open shared object file: No such file or directory
        at [email protected]/com.nvidia.cuvs.spi.UnsupportedProvider.newCuVSResources(UnsupportedProvider.java:35)
        at [email protected]/com.nvidia.cuvs.CuVSResources.create(CuVSResources.java:90)
        at [email protected]/com.nvidia.cuvs.CuVSResources.create(CuVSResources.java:79)
```

Fixes #1321

Authors:
  - Lorenzo Dematté (https://github.com/ldematte)

Approvers:
  - Ishan Chattopadhyaya (https://github.com/chatman)
  - Chris Hegarty (https://github.com/ChrisHegarty)
  - MithunR (https://github.com/mythrocks)

URL: #1316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Development

Successfully merging this pull request may close these issues.

4 participants