Resources locked by a failed transaction are not released [py2neo, neo4j 2.1]

19 views
Skip to first unread message

Guilherme Dinis Junior

unread,
May 20, 2015, 4:07:48 AM5/20/15
to ne...@googlegroups.com
I noticed this behavior while using py2neo 2.0.6, when I attempt to create a Node that violates a unique constraint.
Nigel suggested I bring it up here.

Problem:
--------------
When a transaction attempts to create a resource with a unique constraint, if the transaction fails with a `py2neo.cypher.error.schema.ConstraintViolation` error, any subsequent transactions that attempt to use the resource fail.

Steps:
---------
1. Create unique constraint on a label, e.g. Person (name)
2. Create a node (Person {name: "John"}) using the `CypherTransaction`
3. Attempt to create a node with the same name: (Person {name: "John"}), py2neo throws a `py2neo.cypher.error.schema.ConstraintViolation`, from Neo4j
4. Attempt to delete the node, it fails with a `SocketTimeoutError`

To prevent the SocketTimeout error, one must rollback the transaction, that's `tx.rollback()`, before attempting step 4.

I'm not sure if this is intentional, so we can control our transactions ourselves. But it leaves the db in an inconsistent state if we don't rollback the transaction.
Maybe for certain cases, like `ConstraintViolation` errors, the transaction could be automatically rolled back.

Is this made intentional, and if so, may I ask why?

Thanks

Original post is here

Reply all
Reply to author
Forward
0 new messages