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

Bootstrap should implement a denylist of Java versions (ranges) #3164

Merged
merged 2 commits into from
May 11, 2022

Conversation

reta
Copy link
Collaborator

@reta reta commented May 3, 2022

Signed-off-by: Andriy Redko [email protected]

Description

Implements runtime version checks on startup in order to prevent running with JDK versions known to be flawed (see please [1]). The example of failed bootstrap check:

ERROR: [1] bootstrap checks failed
[1]: The current JVM version 11.0.13+8 is not recommended for use: for more details, please check https://github.com/opensearch-project/OpenSearch/issues/2791 and https://bugs.openjdk.java.net/browse/JDK-8259541

[1] #2791

Issues Resolved

Closes #3005

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@reta reta requested a review from a team as a code owner May 3, 2022 18:19
@reta reta added the backport 2.x Backport to 2.x branch label May 3, 2022
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure d9fde1891763dce034584eb2a7293d5c0ea0791c
Log 4952

Reports 4952

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure f81189adb6d88ed71e16d1ef2257d34558fea14b
Log 4953

Reports 4953

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success f46191c
Log 4956

Reports 4956

@reta reta added v2.1.0 Issues and PRs related to version 2.1.0 v3.0.0 Issues and PRs related to version 3.0.0 labels May 4, 2022
.findAny()
.map(
p -> BootstrapCheckResult.failure(
String.format(Locale.ROOT, "The current JVM version %s is not recommended for use: %s", getVersion(), p.getReason())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we say where it comes from (JAVA_HOME location)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually publish this information at startup already (at the beginning of startup sequence), at this moment we just saying that it is not recommended

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[2022-05-11T10:16:02,879][INFO ][o.o.n.Node               ] [xxx] version[3.0.0-SNAPSHOT], pid[87008], build[tar/7903ceb845b9f4ed395cce28104c689831ae6379/2022-05-10T18:15:09.508767Z], OS[Linux/5.15.0-27-generic/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/17.0.3/17.0.3+7]
[2022-05-11T10:16:02,881][INFO ][o.o.n.Node               ] [xxx] JVM home [/OpenSearch/OpenSearch/distribution/archives/linux-tar/build/install/opensearch-3.0.0-SNAPSHOT/jdk], using bundled JDK [true]
[2022-05-11T10:16:02,882][INFO ][o.o.n.Node               ] [xxx] JVM arguments [-Xshare:auto, -Dopensearch.networkaddress.cache.ttl=60, -Dopensearch.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.locale.providers=SPI,COMPAT, -Xms1g, -Xmx1g, -XX:+UseG1GC, -XX:G1ReservePercent=25, -XX:InitiatingHeapOccupancyPercent=30, -Djava.io.tmpdir=/tmp/opensearch-18176176448873412724, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -XX:MaxDirectMemorySize=536870912, -Dopensearch.path.home=/OpenSearch/OpenSearch/distribution/archives/linux-tar/build/install/opensearch-3.0.0-SNAPSHOT, -Dopensearch.path.conf=/OpenSearch/OpenSearch/distribution/archives/linux-tar/build/install/opensearch-3.0.0-SNAPSHOT/config, -Dopensearch.distribution.type=tar, -Dopensearch.bundled_jdk=true]

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success a123466
Log 4999

Reports 4999

checks.add(new AllPermissionCheck());
checks.add(new DiscoveryConfiguredCheck());
return Collections.unmodifiableList(checks);
}

static class JavaVersionCheck implements BootstrapCheck {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also implement alwaysEnforce so that it cannot by bypassed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure of it: by and large, it is not critical issue which will incur data loss or something, I don't see any checks (besides OutOfMemory) which mandate alwaysEnforce.

@dblock dblock requested a review from kartg May 5, 2022 21:05
@reta
Copy link
Collaborator Author

reta commented May 11, 2022

@dblock @kartg anything left here guys? (comments answered / addressed) thanks!

@kartg kartg merged commit 677915d into opensearch-project:main May 11, 2022
@kartg
Copy link
Member

kartg commented May 11, 2022

@reta sorry, this slipped through my notifications. Merged now 😄

opensearch-trigger-bot bot pushed a commit that referenced this pull request May 11, 2022
* Bootstrap should implement a denylist of Java versions (ranges)

Signed-off-by: Andriy Redko <[email protected]>

* Addressing code review comments

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit 677915d)
@reta
Copy link
Collaborator Author

reta commented May 12, 2022

@reta sorry, this slipped through my notifications. Merged now 😄

Not at problem, thank you @kartg ! 🙇

nknize pushed a commit that referenced this pull request May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch v2.1.0 Issues and PRs related to version 2.1.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bootstrap should implement a denylist of Java versions (ranges)
4 participants