I am using the node-neo4j library on Node.js against Neo4j 1.8GA. The node-neo4j library provides a Node class with a delete method that optionally deletes all relationships on a Node prior to deleting the Node. If the Node has multiple relationships, the library gets all relationships on the Node and deletes them in parallel. If I'm reading the code right, the request to retrieve the relationships and the request to delete the retrieved relationships are all happening concurrently. In my scenario, I have Node A with relationships to Nodes B, C, D. When I call delete on Node A, I get a DeadlockDetectedException (partial stack trace included below). I'm not clear on what resource is being locked in this scenario. The Exception details seem very complete however I'm not quite sure how to interpret them.
Thanks for your help.
Details: 'Transaction(0)[STATUS_ACTIVE,Resources=1] can't wait on resource RWLock[Relationship[27692]] since => Transaction(0)[STATUS_ACTIVE,Resources=1] <-[:HELD_BY]- RWLock[Node[2241]] <-[:WAITING_FOR]- Transaction(0)[STATUS_ACTIVE,Resources=1] <-[:HELD_BY]- RWLock[Relationship[27692]]'.
at org.neo4j.kernel.impl.transaction.RagManager.checkWaitOnRecursive(RagManager.java:218)
at org.neo4j.kernel.impl.transaction.RagManager.checkWaitOnRecursive(RagManager.java:246)
at org.neo4j.kernel.impl.transaction.RagManager.checkWaitOn(RagManager.java:185)
at org.neo4j.kernel.impl.transaction.RWLock.acquireWriteLock(RWLock.java:349)
at org.neo4j.kernel.impl.transaction.LockManager.getWriteLock(LockManager.java:164)
at org.neo4j.kernel.impl.transaction.LockManager.getWriteLock(LockManager.java:130)
at org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.getWriteLock(WriteTransaction.java:870)
at org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.disconnectRelationship(WriteTransaction.java:809)
at org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.relDelete(WriteTransaction.java:689)
at org.neo4j.kernel.impl.persistence.PersistenceManager.relDelete(PersistenceManager.java:166)
at org.neo4j.kernel.impl.core.NodeManager.deleteRelationship(NodeManager.java:989)
at org.neo4j.kernel.impl.core.RelationshipImpl.delete(RelationshipImpl.java:145)
at org.neo4j.kernel.impl.core.RelationshipProxy.delete(RelationshipProxy.java:62)
at org.neo4j.server.rest.web.DatabaseActions.deleteRelationship(DatabaseActions.java:609)
at org.neo4j.server.rest.web.RestfulGraphDatabase.deleteRelationship(RestfulGraphDatabase.java:446)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)