Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-2143

NodeObservor should catch exception in case event processing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.0.7, 1.1.1
    • core
    • None

    Description

      Currently NodeObservor does not catch any exception which might occur while event generation [1] while the ChangeDispatcher does catch the exception [2].

      Due to this if any exception occurs while generating events in NodeObservor the previousState would not be reset. For next contentChanged call would trigger a diff from same old previousState and might again fail with same exception [3]. This would cause duplicate events to be generated. To keep things consistent NodeObservor should also catch and ignore exception (log it and move on) as it is done in ChangeDispatcher

      [1] https://github.com/apache/jackrabbit-oak/blob/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/NodeObserver.java#L120
      [2] https://github.com/apache/jackrabbit-oak/blob/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java#L268
      [3] Exception seen here is caused due to some bug in DocumentNodeStore (being investigated separately)

      24.09.2014 09:13:55.668 *ERROR* [pool-5-thread-5] org.apache.sling.jcr.resource.internal.OakResourceListener Uncaught exception in org.apache.sling.jcr.resource.internal.OakResourceListener@7c9c3fbb
      java.lang.NullPointerException: Node at [/var/eventing/jobs/assigned/62f1f24b-027e-4434-b1ef-a7a3c2c90e16/logouttopic/2014/9/24/15/12] not found for fromRev [r148a837accc-0-4]
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:236)
      	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.diffFewChildren(DocumentNodeStore.java:1628)
      	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.diffImpl(DocumentNodeStore.java:1533)
      	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.diffChildren(DocumentNodeStore.java:1210)
      	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeState.compareAgainstBaseState(DocumentNodeState.java:252)
      	at org.apache.jackrabbit.oak.plugins.observation.EventGenerator$Continuation.run(EventGenerator.java:151)
      	at org.apache.jackrabbit.oak.plugins.observation.EventGenerator.generate(EventGenerator.java:98)
      	at org.apache.jackrabbit.oak.plugins.observation.NodeObserver.contentChanged(NodeObserver.java:155)
      	at org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:117)
      	at org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:111)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:744)
      

      Attachments

        1. OAK-2143.patch
          4 kB
          Chetan Mehrotra

        Issue Links

          Activity

            People

              chetanm Chetan Mehrotra
              chetanm Chetan Mehrotra
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: