Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3036

Resource Claim can violate its "isInUse" assumption causing Null Pointer Exceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 1.1.0
    • None
    • None

    Description

      I hit a Null Pointer Exception when testing on the lastest master. After digging I believe the root cause to be the assumption explained here[1] being violated.

      Specifically I was replaying events on a disk that was over the threshold for not archiving and seeing this[2] stacktrace. So the claimnant count was increased from 0 when "isWritable" was false causing the ResourceClaim to still be a key in the "writeableClaimStreams" map but have a value of null.

      I have tested on 1.0.0 and was not able to reproduce.

      [1] https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/claim/StandardResourceClaim.java#L142-L142
      [2] 2016-11-14 16:00:19,783 INFO [Flow Service Tasks Thread-2] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController@6191c12d // Another save pending = false
      2016-11-14 16:00:21,016 INFO [StandardProcessScheduler Thread-4] o.a.n.c.s.TimerDrivenSchedulingAgent Scheduled GenerateFlowFile[id=01581004-90ba-149c-7ccc-4fe3d2dcfe12] to run with 1 threads
      2016-11-14 16:00:21,017 ERROR [Timer-Driven Process Thread-8] o.a.n.p.standard.GenerateFlowFile GenerateFlowFile[id=01581004-90ba-149c-7ccc-4fe3d2dcfe12] GenerateFlowFile[id=01581004-90ba-149c-7ccc-4fe3d2dcfe12] failed to process due to java.lang.NullPointerException; rolling back session: java.lang.NullPointerException
      2016-11-14 16:00:21,018 ERROR [Timer-Driven Process Thread-8] o.a.n.p.standard.GenerateFlowFile
      java.lang.NullPointerException: null
      at org.apache.nifi.controller.repository.FileSystemRepository$2.write(FileSystemRepository.java:907) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.DisableOnCloseOutputStream.write(DisableOnCloseOutputStream.java:49) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.ByteCountingOutputStream.write(ByteCountingOutputStream.java:46) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.ByteCountingOutputStream.write(ByteCountingOutputStream.java:41) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.FlowFileAccessOutputStream.write(FlowFileAccessOutputStream.java:78) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.processors.standard.GenerateFlowFile$1.process(GenerateFlowFile.java:192) ~[nifi-standard-processors-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2321) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.processors.standard.GenerateFlowFile.onTrigger(GenerateFlowFile.java:189) ~[nifi-standard-processors-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) ~[nifi-api-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1089) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:136) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132) [nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_74]
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_74]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_74]
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_74]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_74]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_74]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74]
      Suppressed: java.lang.NullPointerException: null
      at org.apache.nifi.controller.repository.FileSystemRepository$2.flush(FileSystemRepository.java:923) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.DisableOnCloseOutputStream.close(DisableOnCloseOutputStream.java:68) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.ByteCountingOutputStream.close(ByteCountingOutputStream.java:61) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2322) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      ... 13 common frames omitted
      Suppressed: java.lang.NullPointerException: null
      at org.apache.nifi.controller.repository.FileSystemRepository$2.flush(FileSystemRepository.java:923) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.io.DisableOnCloseOutputStream.close(DisableOnCloseOutputStream.java:68) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2322) ~[nifi-framework-core-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
      ... 13 common frames omitted

      Attachments

        Activity

          People

            markap14 Mark Payne
            jpercivall Joe Percivall
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: