Created attachment 823065 [details] duplicate platform in invenetory Description of problem: See attached screenshot. One of the servers was created with two associated platform instances. It creates all sorts of problems, like the following: 2013-11-12 17:33:19,267 INFO [InventoryManager.discovery-1] (AutoDiscoveryExecutor)- Discovered new platform with 3 child server(s). 2013-11-12 17:33:19,267 INFO [InventoryManager.discovery-1] (InventoryManager)- Sending [server] inventory report to Server... 2013-11-12 17:33:19,437 WARN [InventoryManager.discovery-1] (AutoDiscoveryExecutor)- Exception caught while executing server discovery scan. [Warning] javax.ejb.EJBTransactionRolledbackException: result returns more than one elements at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:138) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:228) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:317) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:214) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) at org.rhq.enterprise.server.discovery.DiscoveryBossLocal$$$view100.getResourceSyncInfo(Unknown Source) at org.rhq.enterprise.server.discovery.DiscoveryBossBean.mergeInventoryReport(DiscoveryBossBean.java:237) Version-Release number of selected component (if applicable): 4.9 How reproducible: Unclear, only one out of a thousand servers. The server itself could have been under a lot of load, or some other condition during the upgrade. Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Also trying to remove the agent itself results in: 17:46:03,335 WARN [org.rhq.enterprise.gui.coregui.server.gwt.ResourceGWTServiceImpl] (http-/0.0.0.0:7081-695) Sending exception to client: [1384278363335] : javax.ejb.EJBExcepti on: javax.persistence.NonUniqueResultException: result returns more than one elements ... at org.rhq.enterprise.server.resource.ResourceManagerLocal$$$view22.uninventoryAllResourcesByAgent(Unknown Source) [rhq-server.jar:4.9.0] at org.rhq.enterprise.gui.coregui.server.gwt.ResourceGWTServiceImpl.uninventoryAllResourcesByAgent(ResourceGWTServiceImpl.java:280) [classes:] public class ResourceManagerBean implements ResourceManagerLocal, ResourceManagerRemote { public Resource getPlatform(Agent agent) { Query query = entityManager.createNamedQuery(Resource.QUERY_FIND_PLATFORM_BY_AGENT); query.setParameter("category", ResourceCategory.PLATFORM); query.setParameter("agent", agent); try { Resource platform = (Resource) query.getSingleResult(); ^^^ return platform; } catch (NoResultException e) { //this means that the agent didn't send any info to us yet. //this can happen during the inital resource upgrade sync between //the agent and server. return null; } } This method should probably guard against multiple entries being returned.
The work-around this problem mostly works: 1) First find the resources for the agent: select * from rhq_resource where agent_id = 14439 order by resource_type_id 2) The Platform resource should appear as resource type in the lower numbers, but be called 'Java' or something. Change the type ID to another type, like '10016' (file system), also set the parent resource ID. Update the row. Then go to the UI and uninventory.
master commit 90794dc7a122a1f519bc7f96fa2078d697a160f5 Author: Jay Shaughnessy <jshaughn> Date: Fri Aug 1 15:09:12 2014 -0400 Add some logging that would have been helpful investigating this issue.
master commit 2a09fd40f5d0b25c5d1c3ba37c553095dc366e60 Author: burmanm <miburman> Date: Tue Aug 5 21:38:40 2014 +0300 Add logging to NativeSystemInfo to detect why Java platform was selected