You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/12/19 18:33:01 UTC
[activemq-artemis] branch master updated: ARTEMIS-2558 Add the
commented out args to dump the java heap on OOME
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/master by this push:
new fcc39c5 ARTEMIS-2558 Add the commented out args to dump the java heap on OOME
new ff8d751 This closes #2897
fcc39c5 is described below
commit fcc39c583ad9001532a752e4072965e12f59c2b5
Author: brusdev <br...@gmail.com>
AuthorDate: Sun Dec 15 07:59:03 2019 +0100
ARTEMIS-2558 Add the commented out args to dump the java heap on OOME
Add the commented out args to dump the first java heap on OOME for
process and backup the last java heap on OOME at startup.
---
.../main/java/org/apache/activemq/artemis/cli/commands/Create.java | 4 +++-
.../resources/org/apache/activemq/artemis/cli/commands/bin/artemis | 5 +++++
.../org/apache/activemq/artemis/cli/commands/bin/artemis.cmd | 6 ++++++
.../org/apache/activemq/artemis/cli/commands/etc/artemis.profile | 5 +++++
.../apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd | 4 ++++
5 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index 07456b5..6e05e9b 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -720,7 +720,9 @@ public class Create extends InputAbstract {
filters.put("${artemis.instance.etc.uri}", etcFolder.toURI().toString());
filters.put("${artemis.instance.etc.uri.windows}", etcFolder.toURI().toString().replaceAll("%", "%%"));
filters.put("${artemis.instance.etc}", path(etcFolder));
- new File(directory, "log").mkdirs();
+ File logFolder = createDirectory("log", directory);
+ File oomeDumpFile = new File(logFolder, "oom_dump.hprof");
+ filters.put("${artemis.instance.oome.dump}", path(oomeDumpFile));
new File(directory, "tmp").mkdirs();
new File(directory, "lib").mkdirs();
File dataFolder = createDirectory(data, directory);
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis
index 57bf96f..72ec821 100755
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis
@@ -112,6 +112,11 @@ if [ -z "$WILDFLY_COMMON" ] ; then
WILDFLY_COMMON="$ARTEMIS_HOME/lib/${wildfly-common}"
fi
+if [ -f "$ARTEMIS_OOME_DUMP" ] ; then
+ # backup the last OOME heap dump
+ mv $ARTEMIS_OOME_DUMP $ARTEMIS_OOME_DUMP.bkp
+fi
+
exec "$JAVACMD" \
$JAVA_ARGS \
-Xbootclasspath/a:"$LOG_MANAGER:$WILDFLY_COMMON" \
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
index 7d7c586..56a27af 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
@@ -52,6 +52,12 @@ rem "Set Defaults."
set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_ETC_URI%/logging.properties
set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
+if not exist "%ARTEMIS_OOME_DUMP%" goto NO_ARTEMIS_OOME_DUMP
+rem "Backup the last OOME heap dump"
+move /Y "%ARTEMIS_OOME_DUMP%" "%ARTEMIS_OOME_DUMP%.bkp"
+
+:NO_ARTEMIS_OOME_DUMP
+
rem "Create full JVM Args"
set JVM_ARGS=%JAVA_ARGS%
if not "%ARTEMIS_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ARTEMIS_CLUSTER_PROPS%
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile
index af8aa86..e0cd93c 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile
@@ -19,6 +19,7 @@ ARTEMIS_HOME='${artemis.home}'
ARTEMIS_INSTANCE='${artemis.instance}'
ARTEMIS_DATA_DIR='${artemis.instance.data}'
ARTEMIS_ETC_DIR='${artemis.instance.etc}'
+ARTEMIS_OOME_DUMP='${artemis.instance.oome.dump}'
# The logging config will need an URI
# this will be encoded in case you use spaces or special characters
@@ -41,6 +42,10 @@ JAVA_ARGS="${java-opts} -XX:+PrintClassHistogram -XX:+UseG1GC -Xms512M -Xmx2G -D
# Replace "all_pauses.log" with the file name you want to log to.
# JAVA_ARGS="$JAVA_ARGS -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+LogVMOutput -XX:LogFile=all_pauses.log"
+#
+# Enables the dumping of the java heap when a java.lang.OutOfMemoryError exception is thrown.
+# JAVA_ARGS="$JAVA_ARGS -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${ARTEMIS_OOME_DUMP}"
+
# Debug args: Uncomment to enable debug
#DEBUG_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd
index 706569e..34e70a4 100644
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile.cmd
@@ -20,6 +20,7 @@ set ARTEMIS_HOME="${artemis.home}"
set ARTEMIS_INSTANCE="${artemis.instance}"
set ARTEMIS_DATA_DIR="${artemis.instance.data}"
set ARTEMIS_ETC_DIR="${artemis.instance.etc}"
+set ARTEMIS_OOME_DUMP="${artemis.instance.oome.dump}"
rem The logging config will need an URI
@@ -41,5 +42,8 @@ rem and dependent by JVM background work (eg method deoptimizations, lock unbias
rem Replace "all_pauses.log" with the file name you want to log to.
rem set JAVA_ARGS=%JAVA_ARGS% -XX:+PrintSafepointStatistics -XX:PrintSafepointStatisticsCount=1 -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+LogVMOutput -XX:LogFile=all_pauses.log
+rem Enables the dumping of the java heap when a java.lang.OutOfMemoryError exception is thrown.
+rem set JAVA_ARGS=%JAVA_ARGS% -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%ARTEMIS_OOME_DUMP%
+
rem Debug args: Uncomment to enable debug
rem set DEBUG_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005