Bug 757175 - NPE in DriftDetection
Summary: NPE in DriftDetection
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: drift
Version: 4.2
Hardware: Unspecified
OS: Unspecified
medium
urgent
Target Milestone: ---
: RHQ 4.3.0,JON 3.0.0
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: jon30-sprint9
TreeView+ depends on / blocked
 
Reported: 2011-11-25 17:03 UTC by Heiko W. Rupp
Modified: 2012-02-07 19:17 UTC (History)
3 users (show)

Fixed In Version: 4.3
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-07 19:17:49 UTC
Embargoed:


Attachments (Terms of Use)

Description Heiko W. Rupp 2011-11-25 17:03:52 UTC
I set drift to watch /etc

It decends into a directory /etc/puppet/ssl, where the agent use has no rights

snert:/im/rhq hrupp$ cd /etc/puppet/ssl/
snert:/etc/puppet/ssl hrupp$ ls
ls: .: Permission denied

so dir.listFiles() returns null and the for() loop bombs out

             for (File file : dir.listFiles()) {



In the agent log:

2011-11-25 17:53:06,211 ERROR [pool-3-thread-1] (rhq.core.pc.drift.DriftDetector)- Drift detection failed: null
java.lang.NullPointerException
        at org.rhq.core.util.file.FileUtil.forEachFile(FileUtil.java:356)
        at org.rhq.core.pc.drift.DriftDetector.doDirectoryScan(DriftDetector.java:481)
        at org.rhq.core.pc.drift.DriftDetector.generateSnapshot(DriftDetector.java:464)
        at org.rhq.core.pc.drift.DriftDetector.run(DriftDetector.java:117)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:680)
2011-11-25 17:53:06,211 INFO  [pool-3-thread-1] (rhq.core.pc.drift.DriftDetector)- Reverting snapshot for DriftDetectionSchedule[resourceId: 10001, driftDefinitionId: 0, driftDefinitionName: Template-File System]

Comment 1 Heiko W. Rupp 2011-11-25 17:19:55 UTC
THis completely prevents drift detection for any file in /etc

ee33194 in master

Comment 2 Libor Zoubek 2011-11-28 17:46:14 UTC
while testing on RHQ 4.3.0.SNAPSHOT, Build Number: b9ef6c8, NPE is gone, but I still don't see any initial snapshot files. 

Instead of NPE, I get 

2011-11-28 18:37:16,124 ERROR [pool-3-thread-1] (rhq.core.pc.drift.DriftDetector)- Drift detection failed: An error occurred while g
enerating a coverage change set for DriftDetectionSchedule[resourceId: 10001, driftDefinitionId: 0, driftDefinitionName: Template-Fi
le System]
org.rhq.core.pc.drift.DriftDetectionException: An error occurred while generating a coverage change set for DriftDetectionSchedule[r
esourceId: 10001, driftDefinitionId: 0, driftDefinitionName: Template-File System]
        at org.rhq.core.pc.drift.DriftDetector$2.visit(DriftDetector.java:499)
        at org.rhq.core.pc.drift.FilterFileVisitor.visit(FilterFileVisitor.java:139)
        at org.rhq.core.util.file.FileUtil.forEachFile(FileUtil.java:361)
        at org.rhq.core.pc.drift.DriftDetector.doDirectoryScan(DriftDetector.java:481)
        at org.rhq.core.pc.drift.DriftDetector.generateSnapshot(DriftDetector.java:464)
        at org.rhq.core.pc.drift.DriftDetector.run(DriftDetector.java:117)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Invalid argument
        at java.io.FileInputStream.available(Native Method)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:325)

Expected behaviour is to have snaphost of files with read permission, right?

Comment 3 John Sanda 2011-11-28 19:59:54 UTC
release_jon3.x commit hash: 5aca5b19e583e8684afc316b31908069825cd35f

Comment 4 Mike Foley 2011-11-29 17:28:07 UTC
verified 

created a directory with no rights ... no exceptions ....

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


Note You need to log in before you can comment on or make changes to this bug.