-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Fix windows memory locking #111866
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
Fix windows memory locking #111866
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6d2e70b
Fix windows memory locking
rjernst 01422e7
Update docs/changelog/111866.yaml
rjernst 67e3991
try to avoid security auto configuration
rjernst ef7d63a
Update docs/changelog/111866.yaml
rjernst e5ff9f9
spotless
rjernst bc8d5ee
fix jdk address to add offset
rjernst 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,5 @@ | ||
| pr: 111866 | ||
| summary: Fix windows memory locking | ||
| area: Infra/Core | ||
| type: bug | ||
| issues: [] |
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
56 changes: 56 additions & 0 deletions
56
qa/packaging/src/test/java/org/elasticsearch/packaging/test/MemoryLockingTests.java
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,56 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
| * in compliance with, at your election, the Elastic License 2.0 or the Server | ||
| * Side Public License, v 1. | ||
| */ | ||
|
|
||
| package org.elasticsearch.packaging.test; | ||
|
|
||
| import org.elasticsearch.packaging.util.ServerUtils; | ||
| import org.elasticsearch.packaging.util.docker.DockerRun; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import static org.elasticsearch.packaging.util.docker.Docker.runContainer; | ||
| import static org.elasticsearch.packaging.util.docker.DockerRun.builder; | ||
|
|
||
| public class MemoryLockingTests extends PackagingTestCase { | ||
|
|
||
| public void test10Install() throws Exception { | ||
| install(); | ||
| } | ||
|
|
||
| public void test20MemoryLockingEnabled() throws Exception { | ||
| configureAndRun(Map.of( | ||
| "bootstrap.memory_lock", | ||
| "true", | ||
| "xpack.security.enabled", | ||
| "false", | ||
| "xpack.security.http.ssl.enabled", | ||
| "false", | ||
| "xpack.security.enrollment.enabled", | ||
| "false", | ||
| "discovery.type", | ||
| "single-node")); | ||
| // TODO: very locking worked. logs? check memory of process? at least we know the process started successfully | ||
| stopElasticsearch(); | ||
| } | ||
|
|
||
| public void configureAndRun(Map<String, String> settings) throws Exception { | ||
| if (distribution().isDocker()) { | ||
| DockerRun builder = builder(); | ||
| settings.forEach(builder::envVar); | ||
| runContainer(distribution(), builder); | ||
| } else { | ||
|
|
||
| for (var setting : settings.entrySet()) { | ||
| ServerUtils.addSettingToExistingConfiguration(installation.config, setting.getKey(), setting.getValue()); | ||
| } | ||
| ServerUtils.removeSettingFromExistingConfiguration(installation.config, "cluster.initial_master_nodes"); | ||
| } | ||
|
|
||
| startElasticsearch(); | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best (but complicated) way of doing this it to check the memory of the process, by calling VirtualQueryEx (and/or the equivalent function under linux/macos) from the test.
It does work cross process, so it should be possible to do that even in a test that spawns an external cluster. No idea how to do that with a docker test though...
Another idea: expose the information we need via an
_nodes/stats(under os.mem maybe?). Could be useful regardless (e.g. for diagnostics)