Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow choosing the path where the native library is extracted using a system property #315

Closed
bgK opened this issue May 27, 2024 · 1 comment

Comments

@bgK
Copy link

bgK commented May 27, 2024

I'm trying to deploy an application using zstd-jni on a system where /tmp is mounted noexec.

zstd-jni initialization fails with the following error:

java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /tmp/libzstd-jni-1.5.5-111543552353015917660.so: /tmp/libzstd-jni-1.5.5-111543552353015917660.so: failed to map segment from shared object

I could override java.io.tmpdir but that affects the rest of the application. The other temporary files are no longer noexec.

I could use the ZstdNativePath system property, but that complexifies the deployment scenario, the proper native library for the architecture needs to be extracted and kept in sync with the java library version.

I could call Native.load(File tempFolder) while initializing the application to override the path. That's weird, because my application has nothing to do with Zstd, I just happen to have zstd-jni on the classpath mostly by accident. It's a transitive runtime dependency of kafka-clients. Netty picks it up and tries to use it.

It would be nice to have a new system property to override the path where zstd-jni extracts the native library. That way, the logic for extracting the native library remains in zstd-jni. Only the deployments where /tmp is mounted as noexec are affected and can set the property to a path where the library can be loaded.

luben added a commit that referenced this issue Jun 19, 2024
The new property is `ZstdTempFolder` and it is used to extract the
native library and load it from there.

Addresses: #315
@luben
Copy link
Owner

luben commented Jul 20, 2024

now it's released as 1.5.6-4. You can specify the ZstdTempFolder property to tell Zstd where to extract the native library

@luben luben closed this as completed Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants