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]
fyi ... <ips1> mfoley: ResourceContainer container = im.getResourceContainer(resourceId); <ips1> Resource resource = container.getResource(); <ips1> line 681 is the 2nd one
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?
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
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.