Bug 786614

Summary: Drift errors in agent.log ,,,, NPE in DriftManager line #681 ... yet Drift seems to be working
Product: [Other] RHQ Project Reporter: Mike Foley <mfoley>
Component: driftAssignee: John Sanda <jsanda>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0.1CC: jsanda
Target Milestone: ---   
Target Release: RHQ 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 833061 (view as bug list) Environment:
Last Closed: 2013-09-01 10:17:12 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: 833061    

Description Mike Foley 2012-02-01 22:24:02 UTC
Description of problem:  Drift errors in agent.log NPE in DriftManager line #681 ... despite the fact the drift seems to be working for me.


Version-Release number of selected component (if applicable):  JON 3.01 RC#1

2012-02-01 16:50:10,616 ERROR [pool-3-thread-3] (rhq.core.pc.drift.DriftDetector)- Drift detection failed: null
java.lang.NullPointerException
	at org.rhq.core.pc.drift.DriftManager.getAbsoluteBaseDirectory(DriftManager.java:681)
	at org.rhq.core.pc.drift.DriftDetector.basedir(DriftDetector.java:523)
	at org.rhq.core.pc.drift.DriftDetector.createHeaders(DriftDetector.java:531)
	at org.rhq.core.pc.drift.DriftDetector.run(DriftDetector.java:117)
	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-02-01 16:50:10,616 INFO  [pool-3-thread-3] (rhq.core.pc.drift.DriftDetector)- Reverting snapshot for DriftDetectionSchedule[resourceId: 10034, driftDefinitionId: 0, driftDefinitionName: Template-File System]
2012-02-01 16:51:10,601 INFO  [MeasurementManager.sender-1] (rhq.core.pc.measurement.MeasurementSenderRunner)- Measurement collection for [5] metrics took 5ms - sending report to Server...
2012-02-01 16:51:18,219 INFO  [InventoryManager.availability-1] (rhq.core.pc.inventory.InventoryManager)- Sending availability report to Server...
2012-02-01 16:52:10,601 INFO  [MeasurementManager.sender-1] (rhq.core.pc.measurement.MeasurementSenderRunner)- Measurement collection for [5] metrics took 5ms - sending report to Server...
2012-02-01 16:52:10,616 ERROR [pool-3-thread-2] (rhq.core.pc.drift.DriftDetector)- Drift detection failed: null
java.lang.NullPointerException
	at org.rhq.core.pc.drift.DriftManager.getAbsoluteBaseDirectory(DriftManager.java:681)
	at org.rhq.core.pc.drift.DriftDetector.basedir(DriftDetector.java:523)
	at org.rhq.core.pc.drift.DriftDetector.createHeaders(DriftDetector.java:531)
	at org.rhq.core.pc.drift.DriftDetector.run(DriftDetector.java:117)
	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-02-01 16:52:10,616 INFO  [pool-3-thread-2] (rhq.core.pc.drift.DriftDetector)- Reverting snapshot for DriftDetectionSchedule[resourceId: 10034, driftDefinitionId: 0, driftDefinitionName: Template-File System]
2012-02-01 16:52:57,652 INFO  [RHQ Agent Prompt Input Thread] (org.rhq.enterprise.agent.AgentMain)- {AgentMain.prompt-command-invoked}Prompt command invoked: [quit]

Comment 1 Mike Foley 2012-02-01 22:27:37 UTC
fyi ...

<ips1> mfoley:         ResourceContainer container = im.getResourceContainer(resourceId);
<ips1>         Resource resource = container.getResource();
<ips1> line 681 is the 2nd one

Comment 2 Mike Foley 2012-02-01 22:55:21 UTC
i turned on agent debug ... and could not repro the error.  perhaps the resolution is to add a little more info to the output or error so that if it happens again?

Comment 4 John Sanda 2012-06-18 13:52:34 UTC
I have adding a check and some error logging if the getAbsoluteBaseDirectory method cannot find a resource container for the resource id argument. The logging outputs the resource id and drift definition to facilitate additional debugging and also suggesting restarting the agent with the -u option. Lastly an IllegalArgumentException is thrown since the method should only receive a resource id for which a resource container exists. Changes have been pushed to master.

commit hash: 7ac42911

Comment 5 Heiko W. Rupp 2013-09-01 10:17:12 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.