You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2015/04/17 19:37:58 UTC

[jira] [Updated] (AMQ-5571) ActiveMQ fails to gracefully shut down if ACTIVEMQ_OPTS_MEMORY uses > 50% of memory

     [ https://issues.apache.org/jira/browse/AMQ-5571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQ-5571:
------------------------------
    Description: 
I’m allocating about 6GB of RAM to ActiveMQ.  The problem is that this box only has 4GB free after that.

If I try to gracefully shut down ActiveMQ tries to run "stop" to gracefully request that ActiveMQ shutdown to avoid recovery on startup.

The problem is that this uses the ACTIVEMQ_OPTS_MEMORY again and since I'm setting memory settings to maximum here this simple command tries to allocate another 9GB.

However, this will fail.  because ACTIVEMQ_OPTS includes ACTIVEMQ_OPTS_MEMORY which is where I set the daemon to use large amounts of memory.

I THINK the resolution to this is to ONLY use ACTIVEMQ_OPTS_MEMORY in "start"…. wouldn’t you agree?

This has a second issue where since I’ms eating -Xms and -Xmx and allocating another 6GB during stop it could trigger an OOM killer and will definitely invalidate a large chunk of the VFS page cache.

Here's a patch that fixes the issue.  

It does NOT fix the issue for the 'status' command.  That would take a larger refactoring of the init script and I'd like to avoid that for now since bash scripts can be fragile.

{noformat}
Index: artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq	(revision 6cf4aa65d9b4362390ba251201cc71b6e2be1458)
+++ artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq	(revision )
@@ -250,7 +250,7 @@
 fi
 
 if [ -z "$ACTIVEMQ_OPTS" ] ; then
-    ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
+    ACTIVEMQ_OPTS="-Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
 fi
 
 # create configuration if requested
@@ -394,7 +394,7 @@
    fi
    # Execute java binary
    if [ -n "$PIDFILE" ] && [ "$PIDFILE" != "stop" ];then
-      $EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
+      $EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS_MEMORY $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
               -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
               -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
               -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
\ No newline at end of file

{noformat}

  was:

I’m allocating about 6GB of RAM to ActiveMQ.  The problem is that this box only has 4GB free after that.

If I try to gracefully shut down ActiveMQ tries to run "stop" to gracefully request that ActiveMQ shutdown to avoid recovery on startup.

The problem is that this uses the ACTIVEMQ_OPTS_MEMORY again and since I'm setting memory settings to maximum here this simple command tries to allocate another 9GB.

However, this will fail.  because ACTIVEMQ_OPTS includes ACTIVEMQ_OPTS_MEMORY which is where I set the daemon to use large amounts of memory.

I THINK the resolution to this is to ONLY use ACTIVEMQ_OPTS_MEMORY in "start"…. wouldn’t you agree?

This has a second issue where since I’ms eating -Xms and -Xmx and allocating another 6GB during stop it could trigger an OOM killer and will definitely invalidate a large chunk of the VFS page cache.

Here's a patch that fixes the issue.  

It does NOT fix the issue for the 'status' command.  That would take a larger refactoring of the init script and I'd like to avoid that for now since bash scripts can be fragile.

Index: artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq	(revision 6cf4aa65d9b4362390ba251201cc71b6e2be1458)
+++ artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq	(revision )
@@ -250,7 +250,7 @@
 fi
 
 if [ -z "$ACTIVEMQ_OPTS" ] ; then
-    ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
+    ACTIVEMQ_OPTS="-Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
 fi
 
 # create configuration if requested
@@ -394,7 +394,7 @@
    fi
    # Execute java binary
    if [ -n "$PIDFILE" ] && [ "$PIDFILE" != "stop" ];then
-      $EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
+      $EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS_MEMORY $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
               -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
               -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
               -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
\ No newline at end of file



> ActiveMQ fails to gracefully shut down if ACTIVEMQ_OPTS_MEMORY uses > 50% of memory
> -----------------------------------------------------------------------------------
>
>                 Key: AMQ-5571
>                 URL: https://issues.apache.org/jira/browse/AMQ-5571
>             Project: ActiveMQ
>          Issue Type: Bug
>            Reporter: Kevin Burton
>
> I’m allocating about 6GB of RAM to ActiveMQ.  The problem is that this box only has 4GB free after that.
> If I try to gracefully shut down ActiveMQ tries to run "stop" to gracefully request that ActiveMQ shutdown to avoid recovery on startup.
> The problem is that this uses the ACTIVEMQ_OPTS_MEMORY again and since I'm setting memory settings to maximum here this simple command tries to allocate another 9GB.
> However, this will fail.  because ACTIVEMQ_OPTS includes ACTIVEMQ_OPTS_MEMORY which is where I set the daemon to use large amounts of memory.
> I THINK the resolution to this is to ONLY use ACTIVEMQ_OPTS_MEMORY in "start"…. wouldn’t you agree?
> This has a second issue where since I’ms eating -Xms and -Xmx and allocating another 6GB during stop it could trigger an OOM killer and will definitely invalidate a large chunk of the VFS page cache.
> Here's a patch that fixes the issue.  
> It does NOT fix the issue for the 'status' command.  That would take a larger refactoring of the init script and I'd like to avoid that for now since bash scripts can be fragile.
> {noformat}
> Index: artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq
> IDEA additional info:
> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
> <+>UTF-8
> ===================================================================
> --- artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq	(revision 6cf4aa65d9b4362390ba251201cc71b6e2be1458)
> +++ artemis-ansible/roles/artemis-scheduler/files/usr/share/apache-activemq/bin/activemq	(revision )
> @@ -250,7 +250,7 @@
>  fi
>  
>  if [ -z "$ACTIVEMQ_OPTS" ] ; then
> -    ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS_MEMORY -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
> +    ACTIVEMQ_OPTS="-Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=$ACTIVEMQ_CONF/login.config"
>  fi
>  
>  # create configuration if requested
> @@ -394,7 +394,7 @@
>     fi
>     # Execute java binary
>     if [ -n "$PIDFILE" ] && [ "$PIDFILE" != "stop" ];then
> -      $EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
> +      $EXEC_OPTION $DOIT_PREFIX "$JAVACMD $ACTIVEMQ_OPTS_MEMORY $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
>                -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \
>                -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \
>                -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
> \ No newline at end of file
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)