Bug 534693 (RHQ-1465) - don't have ant update hang waiting for the agent process
Summary: don't have ant update hang waiting for the agent process
Keywords:
Status: CLOSED NEXTRELEASE
Alias: RHQ-1465
Product: RHQ Project
Classification: Other
Component: Agent
Version: unspecified
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: John Mazzitelli
QA Contact: Jeff Weiss
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-03 20:08 UTC by John Mazzitelli
Modified: 2014-11-09 22:48 UTC (History)
1 user (show)

Fixed In Version: 1.2
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description John Mazzitelli 2009-02-03 20:08:00 UTC
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:

https://issues.apache.org/bugzilla/show_bug.cgi?id=34461

but in addition to needing inputstring="", we also need to worry about the output as well.


Comment 1 John Mazzitelli 2009-02-03 20:09:24 UTC
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 &"

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



Comment 2 John Mazzitelli 2009-02-03 20:22:52 UTC
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

with

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


Comment 3 John Mazzitelli 2009-02-03 21:03:46 UTC
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 17:29:21 UTC
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 17:34:40 UTC
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] 
===== RHQ AGENT INSTALL =====
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 20:33:34 UTC
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.