You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/04/16 06:12:00 UTC

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

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

ASF subversion and git services commented on AMQ-8226:
------------------------------------------------------

Commit bd5af8294427538177381d30e52a4ee83e636b5d in activemq's branch refs/heads/main from Jean-Baptiste Onofré
[ https://gitbox.apache.org/repos/asf?p=activemq.git;h=bd5af82 ]

Merge pull request #648 from Charlie-chenchrl/AMQ-8226

AMQ-8226 match any amount of spaces before activemq PID in bin/active…

> 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
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>             Fix For: 5.17.0, 5.15.15, 5.16.2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)