Bug 856846

Summary: When agent platform has not yet been added to inventory, agent continuously logs WARN Cannot get a resource container for an invalid resource ID=0
Product: [Other] RHQ Project Reporter: Larry O'Leary <loleary>
Component: Agent, InventoryAssignee: Thomas Segismont <tsegismo>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.4CC: hrupp, tsegismo
Target Milestone: ---   
Target Release: RHQ 4.10   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 856845 Environment:
Last Closed: 2014-04-23 08:30:18 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 856845    

Description Larry O'Leary 2012-09-12 19:04:17 EDT
+++ This bug was initially created as a clone of product Bug #856845 +++

Description of problem:
The agent log contains the following warning repeatedly:

WARN  [Content.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Cannot get a resource container for an invalid resource ID=0


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

How reproducible:
Always

Steps to Reproduce:
1. Install JON 3.1.0
2. Register agent with server (DO NOT import platform into inventory)
  
Actual results:
Each time discovery is attempted, the warning is logged.

2012-09-12 16:51:01,075 DEBUG [Content.discovery-1] (rhq.core.pc.content.ContentDiscoveryRunner)- Performing discovery: ScheduledContentDiscoveryInfo:resource-id=[0], package-type=[rpm], interval=[43200000], next-discovery=[Wed Sep 12 16:50:01 CDT 2012
2012-09-12 16:51:01,077 WARN  [Content.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Cannot get a resource container for an invalid resource ID=0
2012-09-12 16:51:01,077 DEBUG [Content.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Stack trace follows:
java.lang.Throwable: This is where resource ID=[0] was passed in
	at org.rhq.core.pc.inventory.InventoryManager.getResourceContainer(InventoryManager.java:490)
	at org.rhq.core.pc.util.ComponentUtil.getComponent(ComponentUtil.java:100)
	at org.rhq.core.pc.content.ContentManager.performContentDiscovery(ContentManager.java:420)
	at org.rhq.core.pc.content.ContentDiscoveryRunner.call(ContentDiscoveryRunner.java:123)
	at org.rhq.core.pc.content.ContentDiscoveryRunner.run(ContentDiscoveryRunner.java:90)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
	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)
2012-09-12 16:51:01,078 WARN  [Content.discovery-1] (rhq.core.pc.content.ContentDiscoveryRunner)- Exception received from component while attempting content retrieval
org.rhq.core.clientapi.agent.PluginContainerException: Resource component container could not be retrieved for resource: 0
	at org.rhq.core.pc.util.ComponentUtil.getComponent(ComponentUtil.java:102)
	at org.rhq.core.pc.content.ContentManager.performContentDiscovery(ContentManager.java:420)
	at org.rhq.core.pc.content.ContentDiscoveryRunner.call(ContentDiscoveryRunner.java:123)
	at org.rhq.core.pc.content.ContentDiscoveryRunner.run(ContentDiscoveryRunner.java:90)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
	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)
2012-09-12 16:51:01,079 WARN  [Content.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Cannot get a resource container for an invalid resource ID=0
2012-09-12 16:51:01,079 DEBUG [Content.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Stack trace follows:
java.lang.Throwable: This is where resource ID=[0] was passed in
	at org.rhq.core.pc.inventory.InventoryManager.getResourceContainer(InventoryManager.java:490)
	at org.rhq.core.pc.content.ContentManager.rescheduleDiscovery(ContentManager.java:360)
	at org.rhq.core.pc.content.ContentDiscoveryRunner.call(ContentDiscoveryRunner.java:130)
	at org.rhq.core.pc.content.ContentDiscoveryRunner.run(ContentDiscoveryRunner.java:90)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
	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)


Expected results:
No warning and no stack trace in DEBUG.

Additional info:
Although this does not seem to impact inventory or inventory synchronization, it is a warning and gives the appearance that something is broken. Of course, this is not the case. Instead, all this simply means is that the agent platform has not yet been imported into inventory and still has a resource ID of 0. Perhaps we should be checking the inventory status for resources containers with ID of 0 and in such cases suppress the warning?
Comment 1 Thomas Segismont 2013-10-11 05:45:59 EDT
Fixed in master

commit 180a9806290cd2031e92585ce126c96d5e96c354
Author: Thomas Segismont <tsegismo@redhat.com>
Date:   Fri Oct 11 11:45:11 2013 +0200

Schedule content discovery if resource is synchronized and COMMITED
Comment 2 Heiko W. Rupp 2014-04-23 08:30:18 EDT
Bulk closing of 4.10 issues.

If an issue is not solved for you, please open a new BZ (or clone the existing one) with a version designator of 4.10.