-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add LD_LIBRARY_PATH to JavaInstallerMixin #11667
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Thanks so much for digging into this! 🦸🏽
I only added one comment, when this is addressed you can directly move forward and merge this PR! 💯
@@ -56,6 +56,7 @@ def get_java_env_vars(self, path: str = None) -> dict[str, str]: | |||
|
|||
return { | |||
"JAVA_HOME": java_home, | |||
"LD_LIBRARY_PATH": f"{java_home}/lib:{java_home}/lib/server", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would effectively overwrite an existing LD_LIBRARY_PATH
wherever we use the Java mixin / this function. I think this should be handled the same way as for the path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexrashed but shouldn't this be treated more like JAVA_HOME
and localised to the Java environment to be used? An invalid exisiting LD_LIBRARY_PATH
value might potentially poison the environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, there definitely shouldn't be a faulty LD_LIBRARY_PATH
, but couldn't it be necessary to have the shared libraries of Java as well as other libraries in the LD_LIBRARY_PATH
?
For example in OpenSeach we add custom libraries for KNN to the LD_LIBRARY_PATH
here:
f"{os.environ.get('LD_LIBRARY_PATH')}:" if "LD_LIBRARY_PATH" in os.environ else "" |
I know that for opensearch we use the Java runtime from the package, but that would be an example where we would have to have multiple paths on the LD_LIBRARY_PATH
.
Background
https://github.com/localstack/localstack-ext/pull/3419 removed the global default JRE installation. This caused certain tests to start failing for aarch64.
Changes
This PR sets the
LD_LIBRARY_PATH
env var with Java libs and adds it to theJavaInstallerMixin
.Generally it is advisable to set
java.library.path
on the JVM's command line. But this approach should be a global fix. Besides this used to be set in the Dockerfile in the era of global JRE.Tests
This was detected with following failure:
Tested passing with following CI run:
https://github.com/localstack/localstack-ext/actions/runs/11272853744/job/31350949612 🟢