From d69cae23e6131269fe80d27f01efac3c8ed950db Mon Sep 17 00:00:00 2001 From: Suyog Rao Date: Mon, 16 Nov 2015 19:57:12 -0800 Subject: [PATCH] Add option for JVM to dump its heap on OutOfMemory Fixes #4192 Fixes #4205 --- bin/logstash.lib.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/logstash.lib.sh b/bin/logstash.lib.sh index a5d6ccee3..b1e86e065 100755 --- a/bin/logstash.lib.sh +++ b/bin/logstash.lib.sh @@ -35,6 +35,11 @@ setup_java() { JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75" JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly" + # Causes the JVM to dump its heap on OutOfMemory. + JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError" + # The path to the heap dump location, note directory must exists and have enough + # space for a full heap dump. + JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=${LOGSTASH_HOME}/heapdump.hprof" fi if [ "$LS_JAVA_OPTS" ] ; then