heroku-buildpack-jvm-common icon indicating copy to clipboard operation
heroku-buildpack-jvm-common copied to clipboard

[BUG] -XX:+UseContainerSupport not present in $JAVA_TOOL_OPTIONS for JAVA_VERSION >= 20

Open greghuc opened this issue 1 year ago • 2 comments
trafficstars

Hi there

I just noticed that -XX:+UseContainerSupport is not present in $JAVA_TOOL_OPTIONS for my app running JAVA_VERSION="22.0.1" (this is the exact line in $JAVA_HOME/release file)

Eyeballing the code, this grep in jvmcommon.sh looks like it breaks for a JAVA_VERSION >= 20, since the regex only handles JAVA_VERSION=10..19

I presume this is a bug, rather than intentional?

Thanks

Greg

greghuc avatar Jun 21 '24 11:06 greghuc

Hi @greghuc!

Thanks for opening this issue! You're absolutely right, this is not intentional. However, UseContainerSupport is enabled by default in the JVM/HotSpot for a long time now. This means that in practice this bug does not have any effect on the app. You should be able to verify this by printing the JVM flags on application startup with -XX:+PrintFlagsFinal.

Ultimately, the buildpack shouldn't set UseContainerSupport explicitly anymore as all supported versions enable this flag by default, even Java 8 (in newer versions).

I will keep this issue open to track that process.

Let me know if you have further input or questions, happy to discuss! :)

Malax avatar Jun 24 '24 10:06 Malax

Hi @Malax

That all makes sense. Thanks for the update!

greghuc avatar Jun 24 '24 10:06 greghuc

It's been some time @greghuc, but setting -XX:+UseContainerSupport will be removed after #348 has been merged and rolled out to customers. Thanks again for taking the time to file this issue last year! :)

Malax avatar Mar 14 '25 12:03 Malax

@Malax thanks for the update!

greghuc avatar Mar 14 '25 12:03 greghuc