Search code examples
neo4jcypherneo4j-node

Neo4J - How to avoid this lock issue


I got this error when I tried to delete two different relationships from a node concurrently.

{ [Error: LockClient[402733] can't wait on resource RWLock[RELATIONSHIP(201056), hash=1039491204] since => LockClient[402733] <-[:HELD_BY]- RWLock[NODE(131064), hash=949197283] <-[:WAITING_FOR]- LockClient[402732] <-[:HELD_BY]- RWLock[RELATIONSHIP(201056), hash=1039491204]] message: 'LockClient[402733] can\'t wait on resource RWLock[RELATIONSHIP(201056), hash=1039491204] since => LockClient[402733] <-[:HELD_BY]- RWLock[NODE(131064), hash=949197283] <-[:WAITING_FOR]- LockClient[402732] <-[:HELD_BY]- RWLock[RELATIONSHIP(201056), hash=1039491204]' }

Is this expected? how do I avoid this?


Solution

  • You can avoid this if your code uses consistent ordering of the stuff to delete, e.g. by node/relationship ids.