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

VersionException when concurrently accessing a node

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.5.0.Final, 5.0.0.Final
    • 4.4.0.Final
    • None
    • None
    • Hide

      See the attached example to reproduce the error. You might have to run mvn clean package a couple of times until the error occurs. Seems to be a concurrency issue.

      Thread A is implemented as class CreateNodeCallable. Thread B is implemented as class GetBaseVersionRunnable. Example is implemented in test VersionExceptionTest.

      Show
      See the attached example to reproduce the error. You might have to run mvn clean package a couple of times until the error occurs. Seems to be a concurrency issue. Thread A is implemented as class CreateNodeCallable. Thread B is implemented as class GetBaseVersionRunnable. Example is implemented in test VersionExceptionTest.
    • Workaround Exists
    • Hide

      I found a workaround for the problem: When I encapsulate the creation of nodes and getting the base version in an user transaction, the problem does not occur even with 40k nodes.

      Show
      I found a workaround for the problem: When I encapsulate the creation of nodes and getting the base version in an user transaction, the problem does not occur even with 40k nodes.

    Description

      There a two threads:

      • Thread A creates new nodes as children of node P and marks the created nodes as versionable.
      • Thread B gets P and iterates over all children. For each child versionManager.getBaseVersion(child.getPath()) is called if the child is versionable.

      When Thread A and B are running at the same time, the following error might occur:

      javax.jcr.version.VersionException: Cannot find the base version with the key 'a69d00a317f1e709b57fe2-f3cf-420e-a33a-c2c40e770f14' for the node '/uploads/test7'. Make sure that any checkin/checkout operations are atomic for that node.
      	at org.modeshape.jcr.AbstractJcrNode.getBaseVersion(AbstractJcrNode.java:3300)
      	at org.modeshape.jcr.JcrVersionManager.getBaseVersion(JcrVersionManager.java:282)
      	at de.doubleslash.modeshape.versionexceptionbug.impl.GetBaseVersionRunnable.run(GetBaseVersionRunnable.java:44)
      	at java.lang.Thread.run(Thread.java:744)
      Caused by: org.modeshape.jcr.cache.NodeNotFoundInParentException: Cannot locate child node: a69d00a317f1e710377623-b2bb-4808-ade4-c8730e8024aa within parent: a69d00a317f1e7jcr:versionStorage
      	at org.modeshape.jcr.cache.document.LazyCachedNode.parentReferenceToSelf(LazyCachedNode.java:247)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getSegment(LazyCachedNode.java:284)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:293)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:292)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:292)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:292)
      	at org.modeshape.jcr.cache.document.LazyCachedNode.getPath(LazyCachedNode.java:292)
      	at org.modeshape.jcr.JcrSession.node(JcrSession.java:562)
      	at org.modeshape.jcr.JcrSession.node(JcrSession.java:507)
      	at org.modeshape.jcr.JcrSession.node(JcrSession.java:485)
      	at org.modeshape.jcr.AbstractJcrNode.getBaseVersion(AbstractJcrNode.java:3296)
      	... 3 more
      

      Might be similiar to MODE-2418.

      Attachments

        Activity

          People

            hchiorean Horia Chiorean (Inactive)
            jkraushaar Jochen Kraushaar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: