Skip to content

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

Merged
merged 4 commits into from
Oct 11, 2024
Merged

Add LD_LIBRARY_PATH to JavaInstallerMixin #11667

merged 4 commits into from
Oct 11, 2024

Conversation

viren-nadkarni
Copy link
Member

@viren-nadkarni viren-nadkarni commented Oct 10, 2024

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 the JavaInstallerMixin.

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:

FAILED tests/aws/services/qldb/test_qldb.py::TestQLDB::test_stream_journal - Exception: Timeout when waiting for KCL initialization.

Tested passing with following CI run:

https://github.com/localstack/localstack-ext/actions/runs/11272853744/job/31350949612 🟢

@viren-nadkarni viren-nadkarni self-assigned this Oct 10, 2024
@viren-nadkarni viren-nadkarni added the semver: patch Non-breaking changes which can be included in patch releases label Oct 10, 2024
@viren-nadkarni viren-nadkarni marked this pull request as ready for review October 10, 2024 13:53
Copy link
Member

@alexrashed alexrashed left a 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",
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link

github-actions bot commented Oct 10, 2024

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 41m 56s ⏱️ -26s
3 492 tests +4  3 079 ✅ +4  413 💤 ±0  0 ❌ ±0 
3 494 runs  +4  3 079 ✅ +4  415 💤 ±0  0 ❌ ±0 

Results for commit fec657f. ± Comparison against base commit 2ececf0.

♻️ This comment has been updated with latest results.

@alexrashed alexrashed merged commit 3026d5c into master Oct 11, 2024
33 of 34 checks passed
@alexrashed alexrashed deleted the java-packaging branch October 11, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants