Bug 719731

Summary: Runtime exception viewing Group Configuration
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: Core UIAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: high    
Version: 4.1CC: hrupp, mazz, skondkar
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-07 19:31:20 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: 729848, 730796    

Description Mike Foley 2011-07-07 19:14:40 UTC
Description of problem:  Runtime exception viewing Group Configuration


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


How reproducible:
100%

Steps to Reproduce:
1.  Inventory-->All Groups--->New
2.  Create group named "test" with 1 resource, the RHQ Agent
3.  View group, Configuration Tab, Current Configuration
  
Actual results:
Globally uncaught exception

Expected results:
View Group Configuration without exception

Additional info:
	
Message :	
Globally uncaught exception
Severity :	
Error
	
Time :	
Thursday, July 7, 2011 3:08:04 PM Etc/GMT+4
Detail :	
java.lang.RuntimeException:One or more null or empty member connection settings was returned by the Server.
--- STACK TRACE FOLLOWS ---
One or more null or empty member connection settings was returned by the Server.
    at Unknown.java_lang_RuntimeException_$RuntimeException__Ljava_lang_RuntimeException_2Ljava_lang_String_2Ljava_lang_RuntimeException_2(Unknown source:0)
    at Unknown.org_rhq_enterprise_gui_coregui_client_inventory_groups_detail_configuration_GroupResourceConfigurationEditView$3$1_$onSuccess__Lorg_rhq_enterprise_gui_coregui_client_inventory_groups_detail_configuration_GroupResourceConfigurationEditView$3$1_2Ljava_util_Map_2V(Unknown source:0)
    at Unknown.org_rhq_enterprise_gui_coregui_client_inventory_groups_detail_configuration_GroupResourceConfigurationEditView$3$1_onSuccess__Ljava_lang_Object_2V(Unknown source:0)
    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown source:0)
    at Unknown.org_rhq_enterprise_gui_coregui_client_util_rpc_TrackingRequestCallback_onResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown source:0)
    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown source:0)
    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown source:0)
    at Unknown.anonymous(Unknown source:0)
    at Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown source:0)
    at Unknown.anonymous(Unknown source:0)
    at Unknown.handleEvent(Unknown source:0)
    at Unknown.SJOWContentBoundary(Unknown source:0)
    at Unknown.anonymous(Unknown source:0)

Comment 1 John Mazzitelli 2011-08-17 17:02:40 UTC
*** Bug 719999 has been marked as a duplicate of this bug. ***

Comment 2 John Mazzitelli 2011-08-17 17:24:24 UTC
side note: looks like copy-paste error with the message. this doesn't have to do with connection settings, its reosurce config. I'm gonna change the four places where that exception message was. For the two that involve resource configuration, it will say:

"The server did not return the configuration for one or more member resources."

For the two that involve connection properties (aka plugin configuration), it will say:

"The server did not return the connection settings for one or more member resources."

Comment 3 John Mazzitelli 2011-08-17 17:34:23 UTC
I see this in the server log, looks related:

13:28:15,437 ERROR [ConfigurationManagerBean] Current Configuration for Resource[id=10364, type=RHQ Agent, key=agent2 RHQ Agent, name=RHQ Agent, parent=agent2, version=4.1.0-SNAPSHOT] does not match latest associated ResourceConfigurationUpdate with SUCCESS status.

From the GWT error message and this log error message, it appears that the server is rejecting the live config because it doesn't match what's in our DB. Thus, it is probably not sending that to the client hence why the client is saying it didn't get one or more configs for a member resource

Comment 4 John Mazzitelli 2011-08-17 17:58:11 UTC
Here is the relevant code in ConfigurationManagerBean. We check to see if the live configs match the latest SUCCESS configs - if they don't, we persist them into the audit history and use it. For some reason, persistNewAgentReportedResourceConfiguration is returning null:

        // If we got this far, we were able to retrieve all of the live configs from the Agents. Now load the current
        // persisted configs from the DB and compare them to the corresponding live configs. For any that are not equal,
        // persist the live config to the DB as the new current config.
        Map<Integer, Configuration> currentPersistedConfigs = getPersistedResourceConfigurationsForCompatibleGroup(group);
        for (Resource memberResource : groupMembers) {
            Configuration liveConfig = liveConfigs.get(memberResource.getId());
            // NOTE: The persisted config may be null if no config has been persisted yet.
            Configuration currentPersistedConfig = currentPersistedConfigs.get(memberResource.getId());
            if (!liveConfig.equals(currentPersistedConfig)) {
                // If the live config is different than the persisted config, persist it as the new current config.
                ResourceConfigurationUpdate update = persistNewAgentReportedResourceConfiguration(memberResource,
                    liveConfig);
                if (update != null)
                    currentPersistedConfigs.put(memberResource.getId(), update.getConfiguration());
                else
                    log.error("Current Configuration for " + memberResource
                        + " does not match latest associated ResourceConfigurationUpdate with SUCCESS status.");
            }
        }

Comment 5 John Mazzitelli 2011-08-17 18:50:47 UTC
I think the problem is that the return value of persistNewAgentReportedResourceConfiguration was not properly understood. If it returns null, it means the live config is the same as the persisted config. But that null value was ignored and we never even stored the live config in the returned map.

Comment 6 John Mazzitelli 2011-08-17 19:50:58 UTC
master commit a7d37237828a22d5ab19cc4ec63f28a5f9ef0083

Comment 7 Sunil Kondkar 2011-08-18 11:19:27 UTC
Verified on build#298 (Version: 4.1.0-SNAPSHOT Build Number: 66918cb)

Created a compatible group of one RHQ Agent. Navigated to the configuration tab of the resource. The configuration details are displayed and no exception is observed. Also verified with adding one more RHQ Agent resource of another platform to the compatible group and navigating to the configuration tab of the group.

Marking as verified.

Comment 8 Mike Foley 2012-02-07 19:31:20 UTC
marking VERIFIED BZs to CLOSED/CURRENTRELEASE

Comment 9 Mike Foley 2012-02-07 19:31:20 UTC
changing status of VERIFIED BZs for JON 2.4.2 and JON 3.0 to CLOSED/CURRENTRELEASE