Bug 1112240 - rhqctl not able to find new defined RHQ_AGENT_PIDFILE_DIR in rhq-agent-env.sh
Summary: rhqctl not able to find new defined RHQ_AGENT_PIDFILE_DIR in rhq-agent-env.sh
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Launch Scripts
Version: JON 3.2
Hardware: All
OS: All
unspecified
high
Target Milestone: ER02
: JON 3.3.0
Assignee: Michael Burman
QA Contact: Filip Brychta
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-23 11:51 UTC by Prachi
Modified: 2018-12-05 18:55 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
An issue in the rhqctl tool with pidFile detection caused the RHQ_AGENT_PIDFILE_DIR and RHQ_SERVER_PIDFILE_DIR environment variables to be ignored. The tool was unable to find the pidfile directory specified by the environment variable, and therefore could not stop the server and agent. The fix removes pidfile detection from rhqctl and uses rhq-agent-wrapper.sh / rhq-server.sh to shut down servers and agents if necessary.
Clone Of:
Environment:
Last Closed: 2014-12-11 14:00:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Prachi 2014-06-23 11:51:33 UTC
Description of problem: rhqctl not able to find new defined RHQ_AGENT_PIDFILE_DIR 


Version-Release number of selected component (if applicable):

JON 3.2


How reproducible:




Steps to Reproduce:

1. redirect the PID file to another directory in rhq-agent-env.sh

RHQ_AGENT_PIDFILE_DIR="/opt/jboss/jon-agent/rhq-agent/pidfiledir"

2. ./rhqctl stop --agent
3. Agent will not stop with this script but it can be stopped with JON GUI

Actual results:

 Agent is not stopping with this script but it can be stopped with JON GUI.

Expected results:

It should stop using ./rhqctl stop --agent


Additional info:

./rhqctl start writes the pid file to the new RHQ_AGENT_PIDFILE_DIR, but it appears that ./rhqctl stop is only looking in the default directory, doesn't find a pid file for the agent and hence doesn't issue the kill

Comment 1 Michael Burman 2014-07-04 10:43:27 UTC
This bug affects also RHQ_SERVER_PIDFILE_DIR, neither is read in the rhqctl tool when trying to find the pidFile.

Fixed in master 906b7ec

Comment 3 Heiko W. Rupp 2014-07-31 15:28:25 UTC
Setting to modified as this is in release/jon3.3.x

Comment 4 Simeon Pinder 2014-07-31 15:51:44 UTC
Moving to ON_QA as available to test with brew build of DR01: https://brewweb.devel.redhat.com//buildinfo?buildID=373993

Comment 5 Filip Brychta 2014-08-05 12:32:52 UTC
The issue is still visible for RHQ_SERVER_PIDFILE_DIR
./rhqctl start --server
works correctly and pid file is created in new location but
./rhqctl stop --server
does not stop the server.

Version :	
3.3.0.DR01
Build Number :	
6468454:dda0a47

Comment 6 Filip Brychta 2014-08-05 13:26:18 UTC
The issue is still visible for RHQ_AGENT_PIDFILE_DIR as well

Comment 7 Michael Burman 2014-08-05 16:12:47 UTC
How are you verifying this? I can't replicate your failure:

[michael@miranda bin]$ ./rhqctl status
19:09:13,398 INFO  [org.jboss.modules] JBoss Modules version 1.3.0.Final-redhat-2
RHQ Storage Node               (no pid file) is ✘down
RHQ Server                     (no pid file) is ✘down
JBossAS Java VM child process  (no pid file) is ✘down
RHQ Agent                      (no pid file) is ✘down
[michael@miranda bin]$ mkdir ~/projects/jon/testpid/
[michael@miranda bin]$ export RHQ_AGENT_PIDFILE_DIR=~/projects/jon/testpid/
[michael@miranda bin]$ export RHQ_SERVER_PIDFILE_DIR=~/projects/jon/testpid/
[michael@miranda bin]$ ./rhqctl start
19:10:31,162 INFO  [org.jboss.modules] JBoss Modules version 1.3.0.Final-redhat-2
 INFO 19:10:31,582 Logging initialized
Trying to start the RHQ Server...
RHQ Server                     (pid 24545  ) is starting
Starting RHQ Agent...
RHQ Agent (pid 24917 ) is ✔running
[michael@miranda bin]$ cat ~/projects/jon/testpid/rhq-server.pid 
24545
[michael@miranda bin]$ cat ~/projects/jon/testpid/rhq-agent.pid 
24917
[michael@miranda bin]$ ./rhqctl status
19:11:06,921 INFO  [org.jboss.modules] JBoss Modules version 1.3.0.Final-redhat-2
RHQ Storage Node               (pid 24305  ) is ✔running
RHQ Server                     (pid 24545  ) is ✔running
JBossAS Java VM child process  (pid 24671  ) is ✔running
RHQ Agent                      (pid 24917  ) is ✔running 
[michael@miranda bin]$ ./rhqctl stop --agent
19:11:13,424 INFO  [org.jboss.modules] JBoss Modules version 1.3.0.Final-redhat-2
Stopping RHQ Agent...
RHQ Agent (pid=24917) is stopping...
RHQ Agent has stopped.
[michael@miranda bin]$ ./rhqctl stop --server
19:11:22,008 INFO  [org.jboss.modules] JBoss Modules version 1.3.0.Final-redhat-2
Trying to stop the RHQ Server...
RHQ Server (pid=24545) is stopping...
RHQ Server has stopped.
[michael@miranda bin]$ ps x | grep 24917
25689 pts/2    S+     0:00 grep --color=auto 24917
[michael@miranda bin]$ ps x | grep 24545
25694 pts/2    S+     0:00 grep --color=auto 24545
[michael@miranda bin]$

As you can see, the pid is detected, put to the correct directory and also shutdown correctly (using the correct pid).

Comment 8 Larry O'Leary 2014-08-05 23:37:48 UTC
I cannot speak for Filip but one important difference from the reproducer steps and your steps is that the RHQ_*_PIDFILE_DIR value is being set in the env files and not in the user's or command's environment.

For the agent this should be in rhq-agent-env and for the server, rhq-server-env.

Comment 9 Filip Brychta 2014-08-06 08:48:20 UTC
Larry is right.
I used following steps:
1 - jon is installed and running with default values
2 - rhqctl stop
3 - set RHQ_AGENT_PIDFILE_DIR in rhq-agent/bin/rhq-agent-env.sh and RHQ_SERVER_PIDFILE_DIR in jon-server-3.3.0.DR01/bin/rhq-server-env.sh
4 - rhqctl start
5 - 
[hudson@fbr-jon33-ora bin]$ ./rhqctl stop
04:34:56,092 INFO  [org.jboss.modules] JBoss Modules version 1.3.3.Final-redhat-1
Stopping RHQ storage node...
RHQ storage node (pid=25801) is stopping...
RHQ storage node has stopped

6 - 
[hudson@fbr-jon33-ora bin]$ ./rhqctl status
04:39:55,255 INFO  [org.jboss.modules] JBoss Modules version 1.3.3.Final-redhat-1
RHQ Storage Node               (no pid file) is ✘down
RHQ Server                     (pid 26018  ) is ✔running
JBossAS Java VM child process  (pid 26141  ) is ✔running
RHQ Agent                      (pid 26325  ) is ✔running 

[hudson@fbr-jon33-ora bin]$ jps
27253 Jps
26325 AgentMain
26141 jboss-modules.jar



The pid files are correctly created in new location after step 4:
[hudson@fbr-jon33-ora bin]$ cat ~/rhq-agent.pid
26325
[hudson@fbr-jon33-ora bin]$ cat ~/rhq-server.pid
26018
[hudson@fbr-jon33-ora bin]$ cat ~/rhq-jvm.pid
26141

Comment 10 Michael Burman 2014-08-11 15:10:23 UTC
Fixed in master. However, I have to say I don't like this change at all, as the whole agent-env.sh / server-env.sh are opposite of the rhqctl movement. Instead of moving features to the rhqctl, we're now returning them back to the .sh scripts. We now have .properties files for some settings and these -env.sh files for some settings. I guess we want to support these -env.sh files still in JON 3.3 instead of moving the functionality?

commit 33a783a0c715beac295419dfea97b7e6ec4e4dfd
Author: Michael Burman <miburman>
Date:   Sat Aug 9 13:56:01 2014 +0300

    [BZ 1112240] Remove pidfile detection from rhqctl and use rhq-agent-wrapper.sh / rhq-server.sh to do the logic of shutting down if necessary

Comment 13 Thomas Segismont 2014-08-28 09:24:38 UTC
commit fdc9ed38e04501bbf3a7edee65aec098c8dccca5
Author: Michael Burman <miburman>
Date:   Sat Aug 9 13:56:01 2014 +0300

    (cherry picked from commit 33a783a0c715beac295419dfea97b7e6ec4e4dfd)
    Signed-off-by: Thomas Segismont <tsegismo>

Comment 14 Thomas Segismont 2014-08-28 09:25:04 UTC
(In reply to Thomas Segismont from comment #13)
> commit fdc9ed38e04501bbf3a7edee65aec098c8dccca5
> Author: Michael Burman <miburman>
> Date:   Sat Aug 9 13:56:01 2014 +0300
> 
>     (cherry picked from commit 33a783a0c715beac295419dfea97b7e6ec4e4dfd)
>     Signed-off-by: Thomas Segismont <tsegismo>

 ^^^ merged into release/jon3.3.x

Comment 15 Simeon Pinder 2014-09-03 20:31:34 UTC
Moving to ON_QA as available for test with the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=381194

Comment 16 Filip Brychta 2014-09-04 11:09:21 UTC
Verified on
Version :	
3.3.0.ER02
Build Number :	
4fbb183:7da54e2


Note You need to log in before you can comment on or make changes to this bug.