Skip to content

Commit 2e8ac06

Browse files
Enable exit on out of memory error (#71542)
Rather than rely on ElasticsearchUncaughtExceptionHandler, it is safer to use the JVM's built-in support for terminating the process on OOM.
1 parent ac76063 commit 2e8ac06

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

distribution/src/config/jvm.options

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
# specified
7272
-XX:+HeapDumpOnOutOfMemoryError
7373

74+
# exit right after heap dump on out of memory error. Recommended to also use
75+
# on java 8 for supported versions (8u92+).
76+
9-:-XX:+ExitOnOutOfMemoryError
77+
7478
# specify an alternative path for heap dumps; ensure the directory exists and
7579
# has sufficient space
7680
@heap.dump.path@

test/external-modules/die-with-dignity/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ tasks.named("javaRestTest").configure {
2222

2323
testClusters.matching { it.name == "javaRestTest" }.configureEach {
2424
systemProperty "die.with.dignity.test", "true"
25+
// disable exit on out of memory error to let DieWithDignityIT verify that OOM handling without that works (including OOMs that are not caused by
26+
// memory like native threads. We leave it to the JVM to test that exit on OOM works via the flag.
27+
jvmArgs '-XX:-ExitOnOutOfMemoryError'
2528
}
2629

2730
tasks.named("test").configure {

0 commit comments

Comments
 (0)