You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Roman Nieviezhyn (Jira)" <ji...@apache.org> on 2021/04/15 19:03:00 UTC

[jira] [Created] (AMQ-8226) If ActiveMQ was started with low numer PID then activemq cli commands fails to check if ActiveMQ process is running.

Roman Nieviezhyn created AMQ-8226:
-------------------------------------

             Summary: If ActiveMQ was started with low numer PID then activemq cli commands fails to check if ActiveMQ process is running.
                 Key: AMQ-8226
                 URL: https://issues.apache.org/jira/browse/AMQ-8226
             Project: ActiveMQ
          Issue Type: Bug
          Components: Command Line Tools
    Affects Versions: 5.15.15
            Reporter: Roman Nieviezhyn


h3. State of the world

[This|[https://github.com/apache/activemq/commit/1cb94f5e48b9265bd78ec01595d7f4d747d7c8e8] ] commit introduced a new approach to check if the ActiveMQ process is running.

[The new approach|https://github.com/apache/activemq/commit/1cb94f5e48b9265bd78ec01595d7f4d747d7c8e8#diff-5306708c9411eee811fbf2bbb46578ed8d34abc2e7313d7e2c4d8db12b48b0f3R390] lists all processes with `ps` command and then greps it:
 local RET="`ps -o "pid,args" | grep "^$activemq_pid\s.*java"`"
h3. Issue

If ActiveMQ process was started with N digit PID and `ps` command returns processes with M digit PID (such that M > N) then `bin/activemq` script won't be able to identify if ActiveMQ is running. 
h3. Example
{noformat}
$ ps -o "pid,args"
  PID COMMAND
   XX ActiveMQ java PROCESS
  XXX ANOTHER PROCESS 1
 XXXX ANOTHER PROCESS 2
XXXXX ANOTHER PROCESS N
{noformat}

In this example `ActiveMQ java PROCESS` is running with a two-digit PID `XX`.
 `ANOTHER PROCESS N` is running with a five-digit PID `XXXXX`.
 
`ps` command will add additional spaces before the `ActiveMQ java PROCESS` to align it to the five-digit PID of `ANOTHER PROCESS N`.
 
In this case the grep experssion `^$activemq_pid\s.*java` wont be able to identify the `ActiveMQ java PROCESS` with PID `XX`.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)