Bug 757175 - NPE in DriftDetection
NPE in DriftDetection
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: drift (Show other bugs)
4.2
Unspecified Unspecified
medium Severity urgent (vote)
: ---
: RHQ 4.3.0,JON 3.0.0
Assigned To: Heiko W. Rupp
Mike Foley
:
Depends On:
Blocks: jon30-sprint9
  Show dependency treegraph
 
Reported: 2011-11-25 12:03 EST by Heiko W. Rupp
Modified: 2012-02-07 14:17 EST (History)
3 users (show)

See Also:
Fixed In Version: 4.3
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-02-07 14:17:49 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Heiko W. Rupp 2011-11-25 12:03:52 EST
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 12:19:55 EST
THis completely prevents drift detection for any file in /etc

ee33194 in master
Comment 2 Libor Zoubek 2011-11-28 12:46:14 EST
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 14:59:54 EST
release_jon3.x commit hash: 5aca5b19e583e8684afc316b31908069825cd35f
Comment 4 Mike Foley 2011-11-29 12:28:07 EST
verified 

created a directory with no rights ... no exceptions ....
Comment 5 Mike Foley 2012-02-07 14:17:49 EST
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.