Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-566

MongoMK throws exception when adding nodes concurrently

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.7
    • mongomk
    • None

    Description

      It seems that there is a problem in the MongoDB microkernel when lots of threads try to commit new nodes concurrently. I have attached a JUnit test which reproduces the error. The test creates 16 microkernels, each committing two nodes in a separate thread. Some threads will throw an exception saying that the node they're trying to commit already exists:

      java.lang.RuntimeException: There's already a child node with name 'node6'
      at org.apache.jackrabbit.mongomk.impl.instruction.CommitCommandInstructionVisitor.visit(CommitCommandInstructionVisitor.java:97)
      at org.apache.jackrabbit.mongomk.impl.instruction.AddNodeInstructionImpl.accept(AddNodeInstructionImpl.java:40)
      at org.apache.jackrabbit.mongomk.impl.command.CommitCommandNew.createMongoNodes(CommitCommandNew.java:155)
      at org.apache.jackrabbit.mongomk.impl.command.CommitCommandNew.execute(CommitCommandNew.java:97)
      at org.apache.jackrabbit.mongomk.impl.command.CommitCommandNew.execute(CommitCommandNew.java:1)
      at org.apache.jackrabbit.mongomk.impl.command.DefaultCommandExecutor.execute(DefaultCommandExecutor.java:38)
      at org.apache.jackrabbit.mongomk.impl.MongoNodeStore.commit(MongoNodeStore.java:110)
      at org.apache.jackrabbit.mongomk.impl.MongoMicroKernel.commit(MongoMicroKernel.java:112)
      ... 7 more

      This cannot be the case however, as the nodes added by the different threads do not overlap / conflict. No exceptions are thrown if setting the number of threads to some lower number, but I have observed that in this case the problem still exists when trying to add a larger number of nodes (more than just 2).

      Attachments

        1. MongoMKConcurrentAddTest.java
          3 kB
          Damien Obrist
        2. OAK-566.patch
          12 kB
          Marcel Reutegger

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dobrist Damien Obrist
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: