Status: Resolved (View Workflow)
Affects Version/s: 5.1.0.Final
Fix Version/s: 5.2.0.Final
Steps to Reproduce:
Git Pull Request:
Consider the following layout where all nodes except for <jcrRepositoryRoot> are versionable:
The ModeShape is running in a clustered mode and there are two members in JGroups cluster (there is a custom JGroups configuration file, which is used in the test project ). The members can reside either in a single JVM (as multiple javax.jcr.Repository instances deployed to the org.modeshape.jcr.ModeShapeEngine) or in multiple JVMs (i.e. one javax.jcr.Repository per JVM).
Say we have N java.util.concurrent.Callable<V> instances. When called, each one obtains a javax.jcr.Session from the first member of the cluster and updates a single <childNodeN> which exists under corresponding <parentNodeN> (i.e. no two instances are configured to update the same child or parent node). Now, an java.util.concurrent.ExecutorService gets to invoke all previously created tasks in parallel using N threads in the pool, which results in an exception that looks like this:
The problem does not happen if:
- there is only one member in the cluster
- having two cluster members, only one thread of execution performs the update using the first member of the cluster
Note, that any kind of write operation results in the same error (every child node is unique and exists under a unique parent):
- updating all child nodes in parallel
- creating all child nodes in parallel
Potentially, the JGroups configuration file used to recreate the problem has some invalid configuration options. For what it is worth, when TRACE log level is enabled, I can see that members of the cluster communicate with each other, i.e. there are send/receive entries.
How to Recreate the Failure
I have created a test project  that can be used to consistently cause the previously described problem. Please, read the documentation  that should explain how to use the tools available in the project and it should also provide a better explanation of the problem and exact steps to take to reproduce it.