Bug 534693 - (RHQ-1465) don't have ant update hang waiting for the agent process
don't have ant update hang waiting for the agent process
Product: RHQ Project
Classification: Other
Component: Agent (Show other bugs)
All All
medium Severity medium (vote)
: ---
: ---
Assigned To: John Mazzitelli
Jeff Weiss
: Improvement
Depends On:
  Show dependency treegraph
Reported: 2009-02-03 15:08 EST by John Mazzitelli
Modified: 2014-11-09 17:48 EST (History)
1 user (show)

See Also:
Fixed In Version: 1.2
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Mazzitelli 2009-02-03 15:08:00 EST
In rhq-agent-update-build.xml, when it launches the new agent, this ant script hangs waiting for the agent process to end - but it shouldn't. It should run rhq-agent-wrapper.sh and when it returns the ant script should exit.

We are hitting this:


but in addition to needing inputstring="", we also need to worry about the output as well.
Comment 1 John Mazzitelli 2009-02-03 15:09:24 EST
After much debugging, stripping down the ant script and agent launcher scripts and testing, I determined that this will correct the problem:

In rhq-agent.sh:

replace this:
   eval "$CMD &"

   eval "$CMD > /something/here 2>&1 &"

Comment 2 John Mazzitelli 2009-02-03 15:22:52 EST
looks like a better solution might be:

in rhq-agent-wrapper.sh:

replace this:

eval $RHQ_AGENT_START_COMMAND > "${RHQ_AGENT_HOME}/logs/rhq-agent-wrapper.log" 2>&1


eval "$RHQ_AGENT_START_COMMAND > \"${RHQ_AGENT_HOME}/logs/rhq-agent-w
rapper.log\" 2>&1"
Comment 3 John Mazzitelli 2009-02-03 16:03:46 EST
fixed the eval statement in rhq-agent-wrapper.sh so it redirects the output properly. also had to use inputstring="" in the update ant script.
Comment 4 John Mazzitelli 2009-03-31 13:29:21 EDT
to test, do something like this:

1) get an agent update binary distribution (if you have a server, its downloadable at http://localhost:7080/agentupdate/download) - call it "rhq-agent-update-binary.jar"
2) install the agent and launch it at the same time using --install and --launch:
    "java -jar rhq-agent-update-binary.jar --install --launch=true"
3) The agent should start, but the "java -jar" process should exit as soon as the agent has started up. It should not hang around until you kill the agent. You should see some logs saying the ant process is done and the "java -jar" process should die.
Comment 5 Jeff Weiss 2009-03-31 13:34:40 EDT
Fixed, rev3509
[jweiss@jweiss jon]$ java -jar agent.jar --install --launch=true======================================
ANT target [(default)]
Tue Mar 31 12:33:58 GMT-05:00 2009
[header-for-install] [echo] 
Installing Agent To: .
Version: 1.2.0-SNAPSHOT
Build Number: 3509
Jar File: /home/jweiss/jon/agent.jar
[install] [echo] Extract the agent distro zip from the agent update binary
[install] [unjar] Expanding: /home/jweiss/jon/agent.jar into /home/jweiss/jon
[install] [echo] Unzip the agent distro into the new installation directory
[install] [unzip] Expanding: /home/jweiss/jon/rhq-enterprise-agent-1.2.0-SNAPSHOT.zip into /home/jweiss/jon
[install] [echo] chmod +x on executables under ./rhq-agent
[install] [echo] Remove the agent distro zip
[install] [delete] Deleting: /home/jweiss/jon/rhq-enterprise-agent-1.2.0-SNAPSHOT.zip
[install] [echo] DONE! Agent version 1.2.0-SNAPSHOT (build number=3509) has been installed to .
ANT target [launch-agent]
Tue Mar 31 12:34:00 GMT-05:00 2009
[launch-agent-unix] [echo] Launching the agent: /home/jweiss/jon/./rhq-agent/bin/rhq-agent-wrapper.sh

[process-exit-code-unix] [echo] Launched Unix agent successfully
[jweiss@jweiss jon]$ 

Comment 6 Red Hat Bugzilla 2009-11-10 15:33:34 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1465

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