-
Notifications
You must be signed in to change notification settings - Fork 1
[RORDEV-1940] Fix ES container startup crash on cgroup v2 hosts (JDK-8287073) #73
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ARG BASE_IMAGE | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| ARG ES_VERSION | ||
| USER root | ||
| COPY patch-es-jdk.sh /tmp/patch-es-jdk.sh | ||
| RUN chmod +x /tmp/patch-es-jdk.sh && ES_VERSION=${ES_VERSION} /tmp/patch-es-jdk.sh && rm -f /tmp/patch-es-jdk.sh | ||
| USER elasticsearch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/bin/sh | ||
| # ES 7.15.1-7.17.6 and 8.0.x-8.4.x bundle JDK 17.0.0/17.0.1/17.0.2 or JDK 18, which have cgroup v2 | ||
| # bug JDK-8287073: CgroupV2Subsystem.getInstance() NPEs before UseContainerSupport is checked. | ||
| # Fixed in JDK 17.0.5+ (backport JDK-8288308) and JDK 19+. | ||
| # We replace the bundled JDK: Corretto 17.0.5 for JDK-17 builds, Corretto 19.0.0 for JDK-18 builds. | ||
| # | ||
| # Usage: | ||
| # ES_VERSION=7.16.0 ./patch-es-jdk.sh # patch the JDK in /usr/share/elasticsearch/jdk | ||
| # ES_VERSION=7.16.0 ./patch-es-jdk.sh --check # exit 0 if patching is needed, 1 otherwise | ||
| set -e | ||
|
|
||
| MAJOR=$(echo "$ES_VERSION" | cut -d. -f1) | ||
| MINOR=$(echo "$ES_VERSION" | cut -d. -f2) | ||
| PATCH=$(echo "$ES_VERSION" | cut -d. -f3) | ||
|
|
||
| CORRETTO_VERSION="" | ||
| if [ "$MAJOR" -eq 7 ] && [ "$MINOR" -eq 15 ] && [ "$PATCH" -ge 1 ]; then | ||
| CORRETTO_VERSION="17.0.5.8.1" | ||
| elif [ "$MAJOR" -eq 7 ] && [ "$MINOR" -eq 16 ]; then | ||
| CORRETTO_VERSION="17.0.5.8.1" | ||
| elif [ "$MAJOR" -eq 7 ] && [ "$MINOR" -eq 17 ] && [ "$PATCH" -le 2 ]; then | ||
| CORRETTO_VERSION="17.0.5.8.1" | ||
| elif [ "$MAJOR" -eq 7 ] && [ "$MINOR" -eq 17 ] && [ "$PATCH" -le 6 ]; then | ||
| CORRETTO_VERSION="19.0.0.36.1" | ||
| elif [ "$MAJOR" -eq 8 ] && [ "$MINOR" -le 1 ]; then | ||
| CORRETTO_VERSION="17.0.5.8.1" | ||
| elif [ "$MAJOR" -eq 8 ] && [ "$MINOR" -le 4 ]; then | ||
| CORRETTO_VERSION="19.0.0.36.1" | ||
| fi | ||
|
|
||
| if [ "$1" = "--check" ]; then | ||
| [ -n "$CORRETTO_VERSION" ] | ||
| exit $? | ||
| fi | ||
|
|
||
| if [ -n "$CORRETTO_VERSION" ]; then | ||
| ARCH=$(uname -m | sed 's/x86_64/x64/' | sed 's/arm64/aarch64/') | ||
| echo "Replacing buggy bundled JDK with Corretto $CORRETTO_VERSION for ES $ES_VERSION (arch: $ARCH)" | ||
| curl -fsSLk "https://corretto.aws/downloads/resources/${CORRETTO_VERSION}/amazon-corretto-${CORRETTO_VERSION}-linux-${ARCH}.tar.gz" -o /tmp/jdk.tar.gz | ||
| rm -rf /usr/share/elasticsearch/jdk | ||
| mkdir -p /usr/share/elasticsearch/jdk | ||
| tar xzf /tmp/jdk.tar.gz -C /usr/share/elasticsearch/jdk --strip-components=1 | ||
| rm /tmp/jdk.tar.gz | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.