Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-5571

ActiveMQ fails to gracefully shut down if ACTIVEMQ_OPTS_MEMORY uses > 50% of memory

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Patch Info:
      Patch Available

      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.

      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
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                burtonator Kevin Burton
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: