Drop JDK 11 support (#16443)

If a user runs Logstash with a hosted JDK and not the one bundled with Logstash distribution, like setting a specific LS_JAVA_HOME, which is minor than JDK 17 then Logstash refuses to start. Has to provide at least a JDK 17 or unset the LS_JAVA_HOME and let Logstash uses the bundled JDK.

Updates the jvm.options and JvmOptionsParser to remove support for JDK 11. If the options parser identifies that the running JVM is less than 17, it refuses to start.

---------

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
This commit is contained in:
Andrea Selva 2024-09-13 17:33:16 +02:00 committed by GitHub
parent 2ebf2658ff
commit 1ec37b7c41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 15 additions and 47 deletions

View file

@ -60,20 +60,14 @@ steps:
value: "adoptiumjdk_21"
- label: "Adoptium JDK 17 (Eclipse Temurin)"
value: "adoptiumjdk_17"
- label: "Adoptium JDK 11 (Eclipse Temurin)"
value: "adoptiumjdk_11"
- label: "OpenJDK 21"
value: "openjdk_21"
- label: "OpenJDK 17"
value: "openjdk_17"
- label: "OpenJDK 11"
value: "openjdk_11"
- label: "Zulu 21"
value: "zulu_21"
- label: "Zulu 17"
value: "zulu_17"
- label: "Zulu 11"
value: "zulu_11"
- wait: ~
if: build.source != "schedule" && build.source != "trigger_job"

View file

@ -33,20 +33,14 @@ steps:
value: "adoptiumjdk_21"
- label: "Adoptium JDK 17 (Eclipse Temurin)"
value: "adoptiumjdk_17"
- label: "Adoptium JDK 11 (Eclipse Temurin)"
value: "adoptiumjdk_11"
- label: "OpenJDK 21"
value: "openjdk_21"
- label: "OpenJDK 17"
value: "openjdk_17"
- label: "OpenJDK 11"
value: "openjdk_11"
- label: "Zulu 21"
value: "zulu_21"
- label: "Zulu 17"
value: "zulu_17"
- label: "Zulu 11"
value: "zulu_11"
- wait: ~
if: build.source != "schedule" && build.source != "trigger_job"

View file

@ -16,10 +16,6 @@
##
################################################################
## GC configuration
11-13:-XX:+UseConcMarkSweepGC
11-13:-XX:CMSInitiatingOccupancyFraction=75
11-13:-XX:+UseCMSInitiatingOccupancyOnly
## Locale
# Set the locale language
@ -59,11 +55,7 @@
#-XX:HeapDumpPath=${LOGSTASH_HOME}/heapdump.hprof
## GC logging
#-Xlog:gc*,gc+age=trace,safepoint:file=@loggc@:utctime,pid,tags:filecount=32,filesize=64m
# log GC status to a file with time stamps
# ensure the directory exists
#-Xloggc:${LS_GC_LOG_FILE}
#-Xlog:gc*,gc+age=trace,safepoint:file=${LS_GC_LOG_FILE}:utctime,pid,tags:filecount=32,filesize=64m
# Entropy source for randomness
-Djava.security.egd=file:/dev/urandom

View file

@ -4,8 +4,8 @@
{ls} requires one of these versions:
* Java 11
* Java 17 (default). Check out <<jdk17-upgrade>> for settings info.
* Java 21
Use the
http://www.oracle.com/technetwork/java/javase/downloads/index.html[official
@ -17,13 +17,13 @@ for the official word on supported versions across releases.
[[bundled-jdk]]
.Bundled JDK
[NOTE]
=====
=====
{ls} offers architecture-specific
https://www.elastic.co/downloads/logstash[downloads] that include
Adoptium Eclipse Temurin 17, the latest long term support (LTS) release of the JDK.
Adoptium Eclipse Temurin 17, a long term support (LTS) release of the JDK.
Use the LS_JAVA_HOME environment variable if you want to use a JDK other than the
version that is bundled.
version that is bundled.
If you have the LS_JAVA_HOME environment variable set to use a custom JDK, Logstash
will continue to use the JDK version you have specified, even after you upgrade.
=====
@ -40,9 +40,9 @@ On systems with Java installed, this command produces output similar to the foll
[source,shell]
-----
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment Temurin-17.0.12+7 (build 17.0.12+7)
OpenJDK 64-Bit Server VM Temurin-17.0.12+7 (build 17.0.12+7, mixed mode)
-----
[float]

View file

@ -46,8 +46,6 @@ Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)
-----
NOTE: As of the publication of this document, please review this https://github.com/elastic/logstash/issues/10496[known issue that impacts Java 11] before proceeding.
Once you have <<setup-logstash>> and validated JVM pre-requisites, you may proceed.
NOTE: For the examples listed below, we are running Windows Server 2016, Java 11.0.3,

View file

@ -318,10 +318,7 @@ class LogStash::Runner < Clamp::StrictCommand
deprecation_logger.deprecated msg
end
if JavaVersion::CURRENT < JavaVersion::JAVA_11
logger.warn I18n.t("logstash.runner.java.version",
:java_home => java.lang.System.getProperty("java.home"))
elsif JavaVersion::CURRENT < JavaVersion::JAVA_17
if JavaVersion::CURRENT < JavaVersion::JAVA_17
deprecation_logger.deprecated I18n.t("logstash.runner.java.version_17_minimum",
:java_home => java.lang.System.getProperty("java.home"))
end

View file

@ -440,14 +440,8 @@ en:
Running Logstash with the bundled JDK is recommended.
The bundled JDK has been verified to work with each specific version of Logstash, and generally provides best performance and reliability.
If you have compelling reasons for using your own JDK (organizational-specific compliance requirements, for example), you can configure LS_JAVA_HOME to use that version instead.
version: >-
Starting from Logstash 8.0, the minimum required version of Java is Java 11; your Java version from
%{java_home} does not meet this requirement. Please reconfigure your version of Java to one that is supported.
Running Logstash with the bundled JDK is recommended.
The bundled JDK has been verified to work with each specific version of Logstash, and generally provides best performance and reliability.
If you have compelling reasons for using your own JDK (organizational-specific compliance requirements, for example), you can configure LS_JAVA_HOME to use that version instead.
version_17_minimum: >-
Starting from Logstash 9.0, the minimum required version of Java will be Java 17;
Starting from Logstash 9.0, the minimum required version of Java is Java 17;
your Java version from `%{java_home}` does not meet this requirement.
Running Logstash with the bundled JDK is recommended.
The bundled JDK has been verified to work with each specific version of Logstash, and generally provides best performance and reliability.

View file

@ -30,7 +30,6 @@ import java.util.Objects;
public class JavaVersion implements Comparable<JavaVersion> {
public static final JavaVersion CURRENT = parse(System.getProperty("java.specification.version"));
public static final JavaVersion JAVA_11 = parse("11");
public static final JavaVersion JAVA_17 = parse("17");
private final List<Integer> version;

View file

@ -30,10 +30,10 @@ import java.util.Objects;
public class JavaVersion implements Comparable<JavaVersion> {
public static final JavaVersion CURRENT = parse(System.getProperty("java.specification.version"));
public static final JavaVersion JAVA_11 = parse("11");
public static final JavaVersion JAVA_17 = parse("17");
private final List<Integer> version;
private JavaVersion(List<Integer> version){
private JavaVersion(List<Integer> version) {
this.version = version;
}

View file

@ -114,11 +114,11 @@ public class JvmOptionsParser {
handleJvmOptions(args, System.getenv("LS_JAVA_OPTS"));
}
static void bailOnOldJava(){
if (JavaVersion.CURRENT.compareTo(JavaVersion.JAVA_11) < 0) {
static void bailOnOldJava() {
if (JavaVersion.CURRENT.compareTo(JavaVersion.JAVA_17) < 0) {
final String message = String.format(
Locale.ROOT,
"The minimum required Java version is 11; your Java version from [%s] does not meet this requirement",
"The minimum required Java version is 17; your Java version from [%s] does not meet this requirement",
System.getProperty("java.home")
);
System.err.println(message);