There are a number of causes if its under heavy load:

1. Multiple threads (mistakenly) sharing the same session.
2. Multiple threads adding a child node the same parent node at exactly the 
same time, although this might also show up as a failure to merge a 
modification.

If operating in a cluster you may find that events from modifications on other 
nodes result in the same problem as the state of the local shared cache changes 
in reaction to events from other nodes.

One solution is to maintain an application level, in memory lock on the parent 
node to prevent concurrent modifications on the same parent node in JVM 
(although this doesn't solve the cluster problem). eg [1]

A better strategy is to use a retry mechanism even propagating to the client 
with a suitable response code. (eg in http  409)

Ian

1. 
http://github.com/ieb/open-experiments/blob/master/slingtests/osgikernel/bundles/locking/src/main/java/org/sakaiproject/nakamura/locking/LockManagerImpl.java

On 30 Mar 2010, at 10:07, Norman Maurer wrote:

> Hi all,
> 
> I have an application which use many threads. Sometimes I see this
> error on heavy load:
> 
> javax.jcr.InvalidItemStateException: Item cannot be saved because it
> has been modified externally: node /
> 
> I wonder how this can happen because I don't add a Node directly to
> the rootNode add this time..
> 
> Is it maybe related to :
> https://issues.apache.org/jira/browse/JCR-2428
> 
> I'm using Jackrabbit 2.0.0 without transactions..
> 
> Bye,
> Norman

Reply via email to