[ 
https://issues.apache.org/jira/browse/OAK-2143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chetan Mehrotra updated OAK-2143:
---------------------------------
    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)
{noformat}
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)
{noformat}

  was:
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 
{noformat}
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/learncube.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)
{noformat}


> NodeObservor should catch exception in case event processing
> ------------------------------------------------------------
>
>                 Key: OAK-2143
>                 URL: https://issues.apache.org/jira/browse/OAK-2143
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>            Priority: Minor
>             Fix For: 1.1, 1.0.7
>
>
> 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)
> {noformat}
> 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)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to