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

Warn when MaxDirectMemorySize or Netty Allocator Type may be incorrect (Windows/JDK8 only issue) #48546

Conversation

williamrandolph
Copy link
Contributor

This PR is intended to backport #48365. However, there's one additional change. Since #48310 is not being backported to 7.5, we need to warn about a potentially incorrect io.netty.allocator.type as well.

…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.
@ywelsch
Copy link
Contributor

ywelsch commented Oct 28, 2019

see #48550

@@ -58,6 +60,11 @@ private JvmErgonomics() {
final long heapSize = extractHeapSize(finalJvmOptions);
final Map<String, String> systemProperties = extractSystemProperties(userDefinedJvmOptions);
if (systemProperties.containsKey("io.netty.allocator.type") == false) {
if (System.getProperty("os.name").startsWith("Windows") && JavaVersion.majorVersion(JavaVersion.CURRENT) == 8) {
Copy link
Member

Choose a reason for hiding this comment

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

As indicated by Yannick this has been backported in #48550 so I think your backport will turn into a backport that is identical to the original one?

@williamrandolph
Copy link
Contributor Author

I'm going to close this PR and reissue with another small fix.

@williamrandolph williamrandolph deleted the fix/7.5/default-max-heap-size-check 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants