Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2610

NodeNotFoundInParentException is thrown when several changes applied to nodes within single session and single transaction

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 5.1.0.Final
    • 5.0.0.Final
    • JCR
    • None
    • Hide

      1) Start transaction
      2) Create node and add child node to it
      3) Commit transaction
      4) Start new transaction and new session
      5) Load child node
      6) Update parent node property
      7) Call session.save()
      4) Remove child node
      5) Second time call session.save() and you will get exception.

      Show
      1) Start transaction 2) Create node and add child node to it 3) Commit transaction 4) Start new transaction and new session 5) Load child node 6) Update parent node property 7) Call session.save() 4) Remove child node 5) Second time call session.save() and you will get exception.

      0) Create node and add child node to it

      Then in another transaction and in brand new session:
      1) Load child node;
      2) Update parent node;
      3) Call session.save();
      4) Remove child node;
      5) Call session.save() and you will get exception.

      This issue is really similar to https://issues.jboss.org/browse/MODE-2608, but fix for that issue didn't resolve this one. I'm still able to reproduce this issue using test, please see attachment.

      Exception:

      javax.jcr.InvalidItemStateException: This session tried to save changes to node with key 'Cannot locate child node: dbb11dd7505d64c117ec3f-18ae-4eb2-9d65-d762209e3b01 within parent: dbb11dd7505d642bdf0eb7-7e89-4a39-b3bd-287b6ebdf6fd', but it was removed by another session.
      	at org.modeshape.jcr.JcrSession.save(JcrSession.java:1171)
      Caused by: org.modeshape.jcr.cache.NodeNotFoundInParentException: Cannot locate child node: dbb11dd7505d64c117ec3f-18ae-4eb2-9d65-d762209e3b01 within parent: dbb11dd7505d642bdf0eb7-7e89-4a39-b3bd-287b6ebdf6fd
      	at org.modeshape.jcr.cache.document.LazyCachedNode.parentReferenceToSelf(LazyCachedNode.java:238)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getSegment(LazyCachedNode.java:282)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:308)
      	at org.modeshape.jcr.cache.PathCache.getPath(PathCache.java:41)
      	at org.modeshape.jcr.cache.document.WritableSessionCache.persistChanges(WritableSessionCache.java:1002)
      	at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:716)
      	at org.modeshape.jcr.JcrSession.save(JcrSession.java:1162)
      	... 31 more 
      

              hchiorean Horia Chiorean (Inactive)
              hot_jira Ostap Shtabura (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: