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

JDK 21 move #15719

Merged
merged 12 commits into from
Apr 3, 2024
Merged

JDK 21 move #15719

merged 12 commits into from
Apr 3, 2024

Conversation

andsel
Copy link
Contributor

@andsel andsel commented Dec 21, 2023

Release notes

Adaptations to run Logstash on JDK 21

What does this PR do?

Adaptations to JDK 21:

Why is it important/What is the impact to the user?

As a developer I want that all the blockings to use JDK 21 are removed before effectively switching the bundled JDK to version 21

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

Author's Checklist

How to test this PR locally

Install a JDK 21 on your host, example:

sdk install java 21.0.2-tem

and run some testing, like

./gradlew runIntegrationTests -PrubyIntegrationSpecs="specs/mixed_codec_spec.rb" --console=plain

or if you would run all integration tests:

export BUILD_JAVA_HOME=/<home>/.sdkman/candidates/java/21.0.2-tem && export RUNTIME_JAVA_HOME=/<home>/.sdkman/candidates/java/21.0.2-tem && export LS_JAVA_HOME=/<home>/.sdkman/candidates/java/21.0.2-tem
ci/integration_tests.sh

try also a run of Logstash with LS_JAVA_HOME set to a JDK 21 path.

Related issues

Use cases

Screenshots

Logs

@andsel andsel self-assigned this Dec 21, 2023
Comment on lines 34 to 35
project.sourceCompatibility = JavaVersion.VERSION_11
project.targetCompatibility = JavaVersion.VERSION_11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for reviewer

Running Gradle 8.5 with JDK 21 with

./gradlew :jvm-options-parser:compileJava

trigger the error:

> Task :jvm-options-parser:compileJava FAILED
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
error: warnings found and -Werror specified

FAILURE: Build failed with an exception.

Java 8 is obsolete and its support will be dropped

@andsel andsel linked an issue Dec 21, 2023 that may be closed by this pull request
6 tasks
Copy link

Quality Gate passed Quality Gate passed

The SonarQube Quality Gate passed, but some issues were introduced.

5 New issues
0 Security Hotspots
100.0% 100.0% Coverage on New Code
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@andsel
Copy link
Contributor Author

andsel commented Feb 15, 2024

As reported in Oracle blog, a new G1 Concurrent GC JMX Bean is published to track remark and clean phases times spent.

GarbageCollectorMXBean for remark and cleanup pause time in G1. The Garbage-First (G1) garbage collector now has a new GarbageCollectorMXBean called G1 Concurrent GC. This bean reports the duration and occurrence of the remark and cleanup garbage collection pauses.

These pauses occur during a complete concurrent mark cycle, increasing the collection counter by two (one for the remark pause and one for the cleanup pause), similar to the CGC field of the jstat -gcutil command. During these pauses, G1 Concurrent GC also updates the memory pool for the G1 Old Gen MemoryManagerMXBean.

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@andsel andsel marked this pull request as ready for review February 15, 2024 16:26
lib/bootstrap/rspec.rb Outdated Show resolved Hide resolved
@andsel andsel requested a review from mashhurs April 3, 2024 08:06
Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

Tested locally, works correctly. LGTM

# It's mainly related to Gradle opening java.base module and this interfere with
# JRuby binding of methods. Full description at https://github.com/jruby/jruby/issues/8061#issuecomment-1908807511
# Remove when Logstash bundle a JRuby version >= 9.4.6.0.
java.util.LinkedHashSet.remove_method(:map) rescue nil
Copy link
Member

Choose a reason for hiding this comment

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

Actually now that main and 8.13 are on JRuby 9.4.6.0 we should be able to remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsvd yep, good spot :-) removed with 1f5f735 and it's green.
Ready for a quick review

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

We should be able to remove the JRuby < 9.4.6.0 workaround since main/8.13 is on that version.

andsel added 2 commits April 3, 2024 16:07
Given that Logstash already ships with JRuby 9.4.6.0 which contains the fix jruby/jruby#8061, the workaround to avoid the original bad param numbers can be removed.
Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @andsel

@andsel andsel requested a review from jsvd April 3, 2024 14:36
Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

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

LGTM

@andsel andsel merged commit 6a04854 into elastic:main Apr 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate Java 21 and Jruby compatibility
5 participants