[ 
https://issues.apache.org/jira/browse/AMQ-3795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244115#comment-13244115
 ] 

Andreas Krause commented on AMQ-3795:
-------------------------------------

What I've done to reproduce these two scenarios:

# Scenario (1)

$ sudo /opt/activemq/bin/activemq status ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ActiveMQ is running (pid '26711')
return code: 0
$ sudo kill 26711                                                               
        # process dies (simulated)
$ sudo /opt/activemq/bin/activemq status ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ActiveMQ not running
return code: 1                                                                  
        # correct
$ sudo /opt/activemq/bin/activemq stop ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ERROR: No or outdated process id in '/opt/activemq/data/activemq.pid'

INFO: Removing /opt/activemq/data/activemq.pid
return code: 1                                                                  
        # wrong!
$ sudo /opt/activemq/bin/activemq stop ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ActiveMQ not running
return code: 0                                                                  
        # correct


# Scenario (2)

$ sudo /opt/activemq/bin/activemq status ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ActiveMQ is running (pid '28852')
return code: 0
$ sudo kill -SIGSTOP 28852                                                      
        # process freezes (simulated)
$ sudo /opt/activemq/bin/activemq status ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ActiveMQ is running (pid '28852')
return code: 0                                                                  
        # wrong
$ sudo /opt/activemq/bin/activemq stop ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
INFO: changing to user 'activemq' to invoke java
INFO: Waiting at least 30 seconds for regular process termination of pid 
'28852' : 
Java Runtime: Sun Microsystems Inc. 1.6.0_30 /usr/java/jdk1.6.0_30/jre
  Heap sizes: current=251264k  free=249951k  max=251264k
    JVM args: -Xms256M -Xmx256M 
-Dorg.apache.activemq.UseDedicatedTaskRunner=true 
-Djava.util.logging.config.file=logging.properties 
-Dactivemq.classpath=/opt/activemq/conf; -Dactivemq.home=/opt/activemq 
-Dactivemq.base=/opt/activemq
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
Connecting to pid: 28852
.............................
INFO: Regular shutdown not successful,  sending SIGKILL to process with pid 
'28852'
return code: 1                                                                  
        # wrong
[... Java Stack Trace ...]
$ sudo /opt/activemq/bin/activemq stop ; echo "return code: $?"
INFO: Loading '/etc/default/activemq'
INFO: Using java '/usr/java/default/bin/java'
ActiveMQ not running
return code: 0                                                                  
        # correct
                
> ActiveMQ standalone script not fully LSB compliant
> --------------------------------------------------
>
>                 Key: AMQ-3795
>                 URL: https://issues.apache.org/jira/browse/AMQ-3795
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.4.3, 5.5.1
>            Reporter: Andreas Krause
>              Labels: LSB
>
> Just like in AMQ-3050, I tried to integrate ActiveMQ into a pacemaker setup.
> As supposed to work, pacemaker should recognize a frozen or dead process an 
> restart the service. For ActiveMQ 5.4.3 and 5.5.1 this does not work in the 
> following two scenarios:
> (1) PID file present, JRE process crashed
> Pacemaker recognizes this correctly (status gives return code 1) and calls 
> "stop" to give the script the chance to deal with the situation (remove stale 
> PID file e.g.). Since this is done successfully it should give a return code 
> of 0, actually it is 1. A return code of 1 tells pacemaker something went 
> wrong when stopping the service, so it changes the state of the resource to 
> "unmanaged (FAILED)" leaving the service in down state.
> (2) PID file present, JRE process present, but frozen for some reason
> First, pacemaker doesn't recognize this ("status" gives return code 0 = 
> running, should be non-zero), so maybe "status" should connect to the JRE and 
> try talk to ActiveMQ in some way instead of just looking for a process?
> Furthermore, if called with "stop" in this case (simulated by sending SIGSTOP 
> to the process), the script tries to connect to the JRE to stop it, fails to 
> do so and finally kills the process forcefully. Since it (in some way) 
> successfully stopped the service, it should return 0, but actually it's 1 as 
> well.
> Return values needed for LSB compliance are given here: 
> http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to