Bug 601880

Summary: JBossAS5 Plugin - ApplicationServerOperationsDelegate uses old plugin configuration after plugin configuration was updated.
Product: [Other] RHQ Project Reporter: Filip Drabek <fdrabek>
Component: PluginsAssignee: Filip Drabek <fdrabek>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: urgent    
Version: 3.0.0CC: cwelton, dsteigne, ian.springer, rtimaniy
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:54:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 725852, 577056, 593121    

Description Filip Drabek 2010-06-08 19:49:16 UTC
Description of problem:
ApplicationServerOperationsDelegate is created in ApplicationServerComponent only once and than is only reused. When plugin configuration is updated ApplicationServerOperationsDelegate will still work with the old configuration which is stored in ApplicationServerOperationsDelegate classes private property and updated only in creation time.

Comment 1 Ian Springer 2010-06-08 21:19:26 UTC
Just to state the obvious, the fix is to (non-lazily!) create (or recreate) the operations delegate in the start() method, rather than lazily creating it in invokeOperation() as is currently being done.

Comment 2 Filip Drabek 2010-06-16 14:14:57 UTC
commit 687cb82196f410a5b512c5f7c69da6e85c5bb3cb

Comment 3 Corey Welton 2010-06-22 12:43:26 UTC
Do we have environment and/or repro steps for this?  I wasn't able to determine what exactly caused the failure.

Comment 4 Filip Drabek 2010-06-25 17:46:41 UTC
Repro steps:

1) Install RHQ server and agent. 
2) Discover and import some EAP5 server to rhq.
3) Turn off the EAP5 server
4) Change property javaHome in EAP5 server configuration(Inventory - Connection) to some non existing path.
5) Start operation "start" on EAP5 server resource component.
6) check if the server is running.
  - if the server is running the bug still occures.
  - if the server is not running the bug is fixed.

Do not restart plugin container during this test.

Comment 5 Corey Welton 2010-06-25 21:41:07 UTC
Sending this back to dev... something weird is going on, not sure if it is related or not. 

I inventoried an eap5 server.  Stopped it, and then when I went into Connection > Properties, I noticed the javaHome field was empty.  I thought that was strange.  In any case, I changed the value to "/tmp", figuring that would fail.

I went to run the start op, and got the following message:


java.lang.IllegalStateException: The 'javaHome' connection property must be set in order to start the application server or to stop it via script.
        at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.initProcessExecution(ApplicationServerOperationsDelegate.java:284)
        at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.start(ApplicationServerOperationsDelegate.java:230)
        at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.invoke(ApplicationServerOperationsDelegate.java:142)
        at org.rhq.plugins.jbossas5.ApplicationServerComponent.invokeOperation(ApplicationServerComponent.java:495)
        at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)

Not sure if this was what i was expecting or not, I went back and cleared the field, i.e., returning it to the state it initially occupied.  I then tried to start server again.  Failed with the same message:


Close Window
java.lang.IllegalStateException: The 'javaHome' connection property must be set in order to start the application server or to stop it via script.
        at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.initProcessExecution(ApplicationServerOperationsDelegate.java:284)
        at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.start(ApplicationServerOperationsDelegate.java:230)
        at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.invoke(ApplicationServerOperationsDelegate.java:142)
        at org.rhq.plugins.jbossas5.ApplicationServerComponent.invokeOperation(ApplicationServerComponent.java:495)
        at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)

Finally, I set the javaHome to "/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/", and attempted to restart the server.

Again, got the same error when executing the op

Close Window
java.lang.IllegalStateException: The 'javaHome' connection property must be set in order to start the application server or to stop it via script.
	at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.initProcessExecution(ApplicationServerOperationsDelegate.java:284)
	at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.start(ApplicationServerOperationsDelegate.java:230)
	at org.rhq.plugins.jbossas5.ApplicationServerOperationsDelegate.invoke(ApplicationServerOperationsDelegate.java:142)
	at org.rhq.plugins.jbossas5.ApplicationServerComponent.invokeOperation(ApplicationServerComponent.java:495)
	at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)


So I think something is pretty wrong here.  I am not sure if this bz is the same root cause, but at very least it is keeping me from running this test cleanly -- and from running the start op at all, regardless of whatever I set javaHome to be.

Comment 7 Rajan Timaniya 2010-07-02 10:34:41 UTC
Verified on JON 2.4 GA_QA  (tag-jon-release  build# 49)
Revision: 10771

Steps:
1) Install RHQ server and agent. 
2) Discover and import some EAP5 server to rhq.
3) Turn off the EAP5 server
4) Change property javaHome in EAP5 server configuration(Inventory -
Connection) to some non existing path.
5) Start operation "start" on EAP5 server resource component.
6) check if the EAP5 server shows running.

Observation:
EAP5 server shows running with wrong 'Java Home'.

Comment 8 Filip Drabek 2010-07-07 21:28:18 UTC
Please test it on RHQ-3.0.0 release. (The fix is in master branch and release-3.0.0 branch)

Comment 9 Sudhir D 2010-07-13 11:34:31 UTC
Tested on rhq build rhq-enterprise-agent-4.0.0-SNAPSHOT. After updating the JAVA_HOME in connection properties, the service still show up.

I shall test this against rhq-server-3.0.0.GA_QA.zip

Comment 10 Corey Welton 2010-07-16 18:45:19 UTC
QA Verified against latest nightly.  Changing the javahome value to "/tmpnothing" causes the start op to fail as expecting it.  Furthermore, changing it back to something normal, i.e., "/usr/lib/jvm/jre-1.6.0-openjdk.x86_64" allows it to work.

Comment 11 Corey Welton 2010-08-12 16:54:23 UTC
Mass-closure of verified bugs against JON.

Comment 12 Ian Springer 2011-07-26 21:35:03 UTC
Note, the fix for this issue is already present in the AdminConsole_EAP_5_1 branch, since it got checked in prior to the RHQ 3.0.0.GA tag, which is what AdminConsole_EAP_5_1 branched from. This means the fix is also present in EAP 5.x admin-consoles, though it's not clear to me if it would even make a difference in the context of the admin-console, which provides no way for a user to edit a resource's plugin config.