Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.12, 2.4.2, 2.5
    • Component/s: jackrabbit-core
    • Labels:
      None

      Description

      When two sessions move nodes in incompatible ways (see test), the hierarchy manager can get into an infinite recursion when building paths.

      Setup: nodes /a/aa & /b.

      // results in /b/a/aa
      session1.move(testRootPath + "/a", testRootPath + "/b/a");
      // results in aa/b/aa/b/aa/b/aa/etc.
      session2.move(testRootPath + "/b", testRootPath + "/a/aa/b");
      session1.save();
      session2.save();

      The problem arises when the hierarchy manager uses a mix of transient states and unmodified states managed by the local item state manager.
      When session 1 is saved, the state change of node a is dispatched to session 2. Node "a" is not changed in session 2, so it's new shared state will be used as-is.
      It will have parent "b" according to the hierarchy manager in session 2.

      The proposed solution is to keep track of the nodes that have been used in building up the path. This has the downside that building up paths becomes more expensive.
      I haven't done any performance measurements yet on the impact of the change. If performance is an issue, perhaps the implementation can be limited to the case that the consistencyCheckEnabled flag is set.

      1. JCR-3291-test.patch
        2 kB
        Frank van Lankvelt
      2. JCR-3291.patch
        3 kB
        Frank van Lankvelt

        Issue Links

          Activity

          Hide
          Frank van Lankvelt added a comment -

          test case & patch.

          Show
          Frank van Lankvelt added a comment - test case & patch.
          Hide
          Bart van der Schans added a comment -

          The real problem is not the stack overflow. That's just a result of a cyclic path which should not have been created in the first place.

          The problem occurs when session2 fetches node a, after it's on move operation. It will get the updated node and hence a cyclic (transient) path is created. The only way to prevent this from happening is to create transient item states of all parents of the destination node. Then session2 will still see node a as child of the test root after the save of session1 happens. The save operation itself fails correctly with a StaleItemStateException.

          Show
          Bart van der Schans added a comment - The real problem is not the stack overflow. That's just a result of a cyclic path which should not have been created in the first place. The problem occurs when session2 fetches node a, after it's on move operation. It will get the updated node and hence a cyclic (transient) path is created. The only way to prevent this from happening is to create transient item states of all parents of the destination node. Then session2 will still see node a as child of the test root after the save of session1 happens. The save operation itself fails correctly with a StaleItemStateException.
          Hide
          Bart van der Schans added a comment -

          Committed fix in trunk in revision 1327432.

          Show
          Bart van der Schans added a comment - Committed fix in trunk in revision 1327432.
          Hide
          Bart van der Schans added a comment -

          Merged in the 2.4 branch in revision 1327441.

          Show
          Bart van der Schans added a comment - Merged in the 2.4 branch in revision 1327441.
          Hide
          Bart van der Schans added a comment -

          Merged in the 2.2 branch in revision 1327476.

          Show
          Bart van der Schans added a comment - Merged in the 2.2 branch in revision 1327476.

            People

            • Assignee:
              Bart van der Schans
              Reporter:
              Frank van Lankvelt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development