thinkaurelius/titan — pull request #50 by BinaryRage (2012-08-13 15:39:16+00:00)
Title: Reentrant write lock leak in SimpleTypeManager

If a concurrent operation creates a type and the STM throws this exception, it leaks the map write lock causing all other type operations to stall:

[error] application - Unexpected error
com.thinkaurelius.titan.core.InvalidElementException: TitanRelation Type with name does already exist: start | false
at com.thinkaurelius.titan.graphdb.types.manager.SimpleTypeManager.committed(SimpleTypeManager.java:77) ~[titan-0.1-SNAPSHOT.jar:na]
at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.commitEdgeTypes(StandardTitanGraph.java:650) ~[titan-0.1-SNAPSHOT.jar:na]
at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.save(StandardTitanGraph.java:638) ~[titan-0.1-SNAPSHOT.jar:na]
at com.thinkaurelius.titan.graphdb.transaction.StandardPersistTitanTx.commit(StandardPersistTitanTx.java:167) ~[titan-0.1-SNAPSHOT.jar:na]
at com.thinkaurelius.titan.graphdb.blueprints.TitanBlueprintsTransaction.stopTransaction(TitanBlueprintsTransaction.java:25) ~[titan-0.1-SNAPSHOT.jar:na]
at com.thinkaurelius.titan.graphdb.blueprints.TitanBlueprintsGraph.stopTransaction(TitanBlueprintsGraph.java:37) ~[titan-0.1-SNAPSHOT.jar:na]

This adds try/finally locks around all blocks betwen the lock/unlock requests.