Jackrabbit Oak
  1. Jackrabbit Oak
  2. OAK-520

IllegalStateException in MemoryNodeBuilder

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.6
    • Component/s: core
    • Labels:
      None

      Description

      AuthorizablePropertyTest.testSetPropertyByRelPath() sometimes causes an IllegalStateException in MemoryNodeBuilder. This might be a problem with the latter uncovered by the recent switch to the p2 index mechanism (OAK-511).

      java.lang.IllegalStateException
          at com.google.common.base.Preconditions.checkState(Preconditions.java:133)
          at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.read(MemoryNodeBuilder.java:205)
          at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.getChildNodeNames(MemoryNodeBuilder.java:379)
          at org.apache.jackrabbit.oak.plugins.index.p2.strategy.ContentMirrorStoreStrategy.remove(ContentMirrorStoreStrategy.java:66)
          at org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexUpdate.apply(Property2IndexUpdate.java:143)
          at org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexDiff.apply(Property2IndexDiff.java:232)
          at org.apache.jackrabbit.oak.plugins.index.IndexHookManager.apply(IndexHookManager.java:71)
          at org.apache.jackrabbit.oak.plugins.index.IndexHookManager.processCommit(IndexHookManager.java:61)
          at org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:59)
          at org.apache.jackrabbit.oak.kernel.KernelNodeStoreBranch.merge(KernelNodeStoreBranch.java:127)
          at org.apache.jackrabbit.oak.core.RootImpl$2.run(RootImpl.java:240)
          at org.apache.jackrabbit.oak.core.RootImpl$2.run(RootImpl.java:236)
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.security.auth.Subject.doAs(Subject.java:337)
          at org.apache.jackrabbit.oak.core.RootImpl.commit(RootImpl.java:235)
          at org.apache.jackrabbit.oak.jcr.SessionDelegate.save(SessionDelegate.java:255)
          at org.apache.jackrabbit.oak.jcr.SessionImpl.save(SessionImpl.java:283)
          at org.apache.jackrabbit.oak.jcr.security.user.AbstractUserTest.tearDown(AbstractUserTest.java:72)
          at org.apache.jackrabbit.test.AbstractJCRTest.run(AbstractJCRTest.java:456)
          at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
          at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
          at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
          at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
          at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) 
      

        Issue Links

          Activity

          Hide
          Alex Parvulescu added a comment -

          I have removed the offending code with rev 1421913. Next, I'll try to understand why this is happening.

          Show
          Alex Parvulescu added a comment - I have removed the offending code with rev 1421913. Next, I'll try to understand why this is happening.
          Hide
          Michael Dürig added a comment -
              at com.google.common.base.Preconditions.checkState(Preconditions.java:133)
              at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.read(MemoryNodeBuilder.java:205)
              at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.getChildNodeNames(MemoryNodeBuilder.java:379)
              at org.apache.jackrabbit.oak.plugins.index.p2.strategy.ContentMirrorStoreStrategy.remove(ContentMirrorStoreStrategy.java:66)
          

          The exceptions means, that remove is called on a node that already is removed.

          Show
          Michael Dürig added a comment - at com.google.common.base.Preconditions.checkState(Preconditions.java:133) at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.read(MemoryNodeBuilder.java:205) at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.getChildNodeNames(MemoryNodeBuilder.java:379) at org.apache.jackrabbit.oak.plugins.index.p2.strategy.ContentMirrorStoreStrategy.remove(ContentMirrorStoreStrategy.java:66) The exceptions means, that remove is called on a node that already is removed.
          Hide
          Alex Parvulescu added a comment -

          I think this might be caused by concurrent index updates and the fact that I'm deleting index nodes while in parallel another thread is trying to update them.
          I'm looking at the failing test and it looks like there are overlapping updates among unit tests probably using the same session.

          This makes me reconsider the idea of pruning the index, and if that is even doable with concurrent updates

          Show
          Alex Parvulescu added a comment - I think this might be caused by concurrent index updates and the fact that I'm deleting index nodes while in parallel another thread is trying to update them. I'm looking at the failing test and it looks like there are overlapping updates among unit tests probably using the same session. This makes me reconsider the idea of pruning the index, and if that is even doable with concurrent updates
          Hide
          Alex Parvulescu added a comment -

          > The exceptions means, that remove is called on a node that already is removed.
          Interesting, adding

          if (node.isRemoved()) {
            continue;
          }
          

          seems to help the test pass

          But I'm worried about index corruption, deleting a path while an update is in place would not be too good.

          Show
          Alex Parvulescu added a comment - > The exceptions means, that remove is called on a node that already is removed. Interesting, adding if (node.isRemoved()) { continue ; } seems to help the test pass But I'm worried about index corruption, deleting a path while an update is in place would not be too good.
          Hide
          Michael Dürig added a comment -

          Which confirms that the node is already removed at that point. Begs the questions from whom?

          Show
          Michael Dürig added a comment - Which confirms that the node is already removed at that point. Begs the questions from whom?
          Hide
          Alex Parvulescu added a comment -

          I'm thinking it is a different update to the same node that comes from another unit test running in parallel.

          Show
          Alex Parvulescu added a comment - I'm thinking it is a different update to the same node that comes from another unit test running in parallel.
          Hide
          Michael Dürig added a comment -

          I improved error reporting for such cases in revision 1421932

          Show
          Michael Dürig added a comment - I improved error reporting for such cases in revision 1421932
          Hide
          Alex Parvulescu added a comment -

          I have refactored the code a bit, but I ran into OAK-531.

          Show
          Alex Parvulescu added a comment - I have refactored the code a bit, but I ran into OAK-531 .
          Hide
          Alex Parvulescu added a comment -

          fixed with rev 1423962.

          Show
          Alex Parvulescu added a comment - fixed with rev 1423962.

            People

            • Assignee:
              Alex Parvulescu
              Reporter:
              Michael Dürig
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development