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

BPE_APPEND_JAVA_TOOL_OPTIONS Concatenation Issue with paketo-buildpacks/builder-jammy-java-tiny #41

Open
ubermensch37 opened this issue Feb 21, 2025 · 1 comment

Comments

@ubermensch37
Copy link

BPE_APPEND_JAVA_TOOL_OPTIONS Concatenation Issue with paketo-buildpacks/builder-jammy-java-tiny

Expected Behavior

The BPE_APPEND_JAVA_TOOL_OPTIONS environment variable should append new Java tool options to the existing JAVA_TOOL_OPTIONS with a space as a separator. For example, if JAVA_TOOL_OPTIONS is -XX:ExitOnOutOfMemoryError and BPE_APPEND_JAVA_TOOL_OPTIONS is -XX:UseSVE=0, the resulting options should be -XX:ExitOnOutOfMemoryError -XX:UseSVE=0.

Current Behavior

BPE_APPEND_JAVA_TOOL_OPTIONS concatenates the new options directly to the existing JAVA_TOOL_OPTIONS without a space. Using the same example, the result is -XX:ExitOnOutOfMemoryError-XX:UseSVE=0. This leads to the JVM failing to recognize the options.

Possible Solution

Modify the buildpack logic to include a space when appending the value of BPE_APPEND_JAVA_TOOL_OPTIONS to JAVA_TOOL_OPTIONS. A simple fix would be to ensure a space is added between the existing options and the appended options.

Steps to Reproduce

  1. Use the paketobuildpacks/builder-jammy-java-tiny buildpack (or a buildpack that uses this builder).
  2. Set the BPE_APPEND_JAVA_TOOL_OPTIONS environment variable to -XX:UseSVE=0.
  3. Build the image.
  4. Attempt to run the application. It will likely fail with an "Unrecognized VM option" error.

Unrecognized VM option 'ExitOnOutOfMemoryError-XX:UseSVE=0'
Did you mean '(+/-)ExitOnOutOfMemoryError'?
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Motivations

This issue is critical for running Java applications on M4 processors. The JDK on these processors often requires the -XX:UseSVE=0 option. Because of this bug, we cannot reliably deploy Java applications using the paketobuildpacks/builder-jammy-java-tiny buildpack on M4 architectures. This blocks us from utilizing these processors effectively. This issue is related to OpenJDK bug JDK-8345296.

@dmikusa
Copy link
Contributor

dmikusa commented Feb 21, 2025

Thanks for reaching out. If you have not, please try setting BPE_DELIM_JAVA_TOOL_OPTIONS=' '. The default delimiter is an empty string, which is why I believe that you're seeing this behavior.

https://github.com/paketo-buildpacks/environment-variables

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