cancel
Showing results for 
Search instead for 
Did you mean: 

ConcurrencyFailureException

rjohnson
Star Contributor
Star Contributor
We are currently creating an interface to allow an imaging system to store images in alfresco against an event record document.

The process is that the imaging system calls a SOAP object that creates the event record document and then the imaging system calls another method on the SOAP object to create a series of images that are stored in Alfresco. The SOAP object to store the images calls a simple Javascript webscript to store the content and it also create an association between the event record document and the image file it just created.

When we run this we seem to get an error at random:

Error:JavaException: org.springframework.dao.ConcurrencyFailureException: Failed to update node 69939

There are a few posts on this in the forums but these all seem to relate to MySQL and we are using Alfresco 4.2e and PostgreSQL. None of the posts offer much of a solution apart from one on MySQL which talks of adjusting the index locking strategy. Clearly that is not relevant to PostgreSQL.

Anyone with any ideas on this?

Could we detect the error and retry? Do we need to limit concurrency on the SOAP service? Is there a PostgerSQL adjustment to make?

Thank you all for your help.
3 REPLIES 3

angelborroy
Community Manager Community Manager
Community Manager
Actually this is not a database exception, it occurs on NodeService Java class when updating a node: if some other process is modifying it, you obtain this exception. Maybe a good point is to put your process on background and retry until the node is released.

<java>
public abstract class AbstractNodeDAOImpl implements NodeDAO, BatchingDAO
{
   
    private boolean updateNodeImpl(Node oldNode, NodeUpdateEntity nodeUpdate, Set<QName> nodeAspects)
    {

        // Do concurrency check
        if (count != 1)
        {
            // Drop the value from the cache in case the cache is stale
            nodesCache.removeByKey(nodeId);
            nodesCache.removeByValue(nodeUpdate);
           
            throw new ConcurrencyFailureException("Failed to update node " + nodeId, concurrencyException);
        }

    }
}

</java>

However, we solved an issue like this including our node modifications as a behavior. 
Hyland Developer Evangelist

I have the same issue. I'm using Alfresco Enterprise v4.1.6

I create a new node and then modify some properties of the parents doing a getNodeService().addProperties.

Sometimes, this addProperties fails and give me a org.springframework.dao.ConcurrencyFailureException: Failed to update node 288941

And when it occurs, I can't see the node that I create and can't doing anything on this node. Only works again if I restart Alfresco tomcat server.

I don't understand the last solution, sorry. This only delete the node that gives me problem. It's ok? But what is count? And nodesCache?

Thank you!

Regards,

Jordi

angelborroy
Community Manager Community Manager
Community Manager
The solution is to implement your changes by using behaviors: onCreateNode event should be a good point to start.

Included code was only the piece of Alfresco code which is launching Concurrency Exception.
Hyland Developer Evangelist