Skip to content

Commit

Permalink
Always exit on OOME
Browse files Browse the repository at this point in the history
With this commit we add the JVM flag `ExitOnOutOfMemoryError`
unconditionally when Elasticsearch is configured by Rally. Previously we
had to check whether the JVM in use supports this flag because we
supported Elasticsearch 1.x which can be run with Java 1.7. As the JVM flag
has only been introduced with Java 8, we had a check in place. Now that
we have dropped support for Elasticsearch 1.x (in elastic#716), we can safely
assume that the JVM supports this flag and unconditionally set it.

Relates elastic#715
Relates elastic#723
  • Loading branch information
danielmitterdorfer authored and ebadyano committed Jul 16, 2019
1 parent 0f456d7 commit 28577c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 2 additions & 9 deletions esrally/mechanic/provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,10 @@ def cleanup(self):
self.es_installer.cleanup(self.preserve)

def _prepare_java_opts(self):
java_opts = []
# To detect out of memory errors during the benchmark
java_opts = ["-XX:+ExitOnOutOfMemoryError"]
if self.telemetry is not None:
java_opts.extend(self.telemetry.instrument_candidate_java_opts(self.es_installer.car, self.es_installer.node_name))

exit_on_oome_flag = "-XX:+ExitOnOutOfMemoryError"
if jvm.supports_option(self.es_installer.java_home, exit_on_oome_flag):
self.logger.info("Setting [%s] to detect out of memory errors during the benchmark.", exit_on_oome_flag)
java_opts.append(exit_on_oome_flag)
else:
self.logger.info("JVM does not support [%s]. A JDK upgrade is recommended.", exit_on_oome_flag)

return java_opts

def _provisioner_variables(self):
Expand Down
3 changes: 3 additions & 0 deletions tests/mechanic/provisioner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
"cluster_settings": {
"indices.query.bool.max_clause_count": 50000,
},
"additional_java_settings": ["-XX:+ExitOnOutOfMemoryError"],
"heap": "4g",
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
Expand Down Expand Up @@ -184,6 +185,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
"indices.query.bool.max_clause_count": 50000,
"plugin.mandatory": ["x-pack-security"]
},
"additional_java_settings": ["-XX:+ExitOnOutOfMemoryError"],
"heap": "4g",
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
Expand Down Expand Up @@ -261,6 +263,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars):
"indices.query.bool.max_clause_count": 50000,
"plugin.mandatory": ["x-pack"]
},
"additional_java_settings": ["-XX:+ExitOnOutOfMemoryError"],
"heap": "4g",
"cluster_name": "rally-benchmark",
"node_name": "rally-node-0",
Expand Down

0 comments on commit 28577c6

Please sign in to comment.