diff --git a/distribution/src/config/jvm.options b/distribution/src/config/jvm.options index 67bda171d1bb0..a0c5ef53fc14a 100644 --- a/distribution/src/config/jvm.options +++ b/distribution/src/config/jvm.options @@ -71,6 +71,10 @@ # specified -XX:+HeapDumpOnOutOfMemoryError +# exit right after heap dump on out of memory error. Recommended to also use +# on java 8 for supported versions (8u92+). +9-:-XX:+ExitOnOutOfMemoryError + # specify an alternative path for heap dumps; ensure the directory exists and # has sufficient space @heap.dump.path@ diff --git a/test/external-modules/die-with-dignity/build.gradle b/test/external-modules/die-with-dignity/build.gradle index dc79a6f0275e1..3466b7bb24adc 100644 --- a/test/external-modules/die-with-dignity/build.gradle +++ b/test/external-modules/die-with-dignity/build.gradle @@ -22,6 +22,9 @@ tasks.named("javaRestTest").configure { testClusters.matching { it.name == "javaRestTest" }.configureEach { systemProperty "die.with.dignity.test", "true" + // disable exit on out of memory error to let DieWithDignityIT verify that OOM handling without that works (including OOMs that are not caused by + // memory like native threads. We leave it to the JVM to test that exit on OOM works via the flag. + jvmArgs '-XX:-ExitOnOutOfMemoryError' } tasks.named("test").configure {