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

[7.4 backport] Add warnings for potential ergonomics failures for JDK8/Windows #49043

Merged
merged 3 commits into from
Nov 15, 2019

Conversation

williamrandolph
Copy link
Contributor

The 7.4 branch doesn't have the fix that removes the ergonomic configuration of the netty allocator, so the only difference between this branch and the 7.5 backport ( #48968 ) is a warning when the ergonomics bugs might affect the netty allocator settings.

…ue) (elastic#48365)

Our JVM ergonomics extract max heap size from JDK PrintFlagsFinal output.
On JDK 8, there is a system-dependent bug where memory sizes are cast to
32-bit integers. On affected systems (namely, Windows), when 1/4 of physical
memory is more than the maximum integer value, the output of PrintFlagsFinal
will be inaccurate. In the pathological case, where the max heap size would
be a multiple of 4g, the test will fail.

The practical effect of this bug, beyond test failures, is that we may set
MaxDirectMemorySize to an incorrect value on Windows. This commit adds a
warning about this situation during startup.

On 7.4, we also warn for io.netty.allocator.type.
…8657)

* Always pass user-specified MaxDirectMemorySize

We had been testing whether a user had passed a value for
MaxDirectMemorySize by parsing the output of "java -XX:PrintFlagsFinal
-version". If MaxDirectMemorySize equals zero, we set it to half of max
heap. The problem is that on Windows with JDK 8, a JDK bug incorrectly
truncates values over 4g and returns multiples of 4g as zero. In order
to always respect the user-defined settings, we need to check our input
to see if an "-XX:MaxDirectMemorySize" value has been passed.

* Always warn for Windows/jdk8 ergo issue

Even if a user has set MaxDirectMemorySize, they aren't future-proof for
this JDK bug. With this change, we issue a general warning for the
windows/JDK8 issue, and a specific warning if MaxDirectMemorySize is
unset.
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

LGTM. Can you please also apply the appropriate labels before merging?

@williamrandolph williamrandolph added backport v7.4.3 :Core/Infra/Core Core issues without another label labels Nov 15, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Core)

@williamrandolph williamrandolph merged commit 99a7ea5 into elastic:7.4 Nov 15, 2019
@williamrandolph williamrandolph deleted the fix/7.4/winjdk8-warnings branch May 23, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport >bug :Core/Infra/Core Core issues without another label v7.4.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants