Conccurent transactions and TemporaryWriteException


#1

Hi again

I experiment a specific exception when I have some concurrent transaction around the same element.
Basically, my transaction is a field update (delete if alone, delete via if multiple then create)

2019-01-26 21:18:03,850 [grpc-default-executor-149] ERROR a.g.e.r.SessionService$TransactionListener - Runtime Exception in RPC TransactionListener: 
java.lang.RuntimeException: ai.grakn.exception.TemporaryWriteException: Internal locking exception. Please clear the transaction and try again.
	at ai.grakn.engine.rpc.SessionService$TransactionListener.submit(SessionService.java:202)
	at ai.grakn.engine.rpc.SessionService$TransactionListener.onNext(SessionService.java:115)
	at ai.grakn.engine.rpc.SessionService$TransactionListener.onNext(SessionService.java:79)
	at io.grpc.stub.ServerCalls$StreamingServerCallHandler$StreamingServerCallListener.onMessage(ServerCalls.java:248)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailable(ServerCallImpl.java:263)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable.runInContext(ServerImpl.java:683)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: ai.grakn.exception.TemporaryWriteException: Internal locking exception. Please clear the transaction and try again.
	at ai.grakn.exception.TemporaryWriteException.temporaryLock(TemporaryWriteException.java:48)
	at ai.grakn.kb.internal.GraknTxJanus.executeLockingMethod(GraknTxJanus.java:109)
	at ai.grakn.kb.internal.GraknTxJanus.commitTransactionInternal(GraknTxJanus.java:87)
	at ai.grakn.kb.internal.EmbeddedGraknTx.commitWithLogs(EmbeddedGraknTx.java:750)
	at ai.grakn.kb.internal.EmbeddedGraknTx.commitAndGetLogs(EmbeddedGraknTx.java:723)
	at ai.grakn.engine.rpc.SessionService$TransactionListener.commit(SessionService.java:218)
	at ai.grakn.engine.rpc.SessionService$TransactionListener.handleRequest(SessionService.java:137)
	at ai.grakn.engine.rpc.SessionService$TransactionListener.lambda$onNext$0(SessionService.java:115)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 3 common frames omitted
Caused by: org.janusgraph.core.JanusGraphException: Could not commit transaction due to exception during persistence
	at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.commit(StandardJanusGraphTx.java:1390)
	at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph$GraphTransaction.doCommit(JanusGraphBlueprintsGraph.java:298)
	at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.commit(AbstractTransaction.java:104)
	at ai.grakn.kb.internal.EmbeddedGraknTx.commitTransactionInternal(EmbeddedGraknTx.java:766)
	at ai.grakn.kb.internal.GraknTxJanus.lambda$commitTransactionInternal$0(GraknTxJanus.java:88)
	at ai.grakn.kb.internal.GraknTxJanus.executeLockingMethod(GraknTxJanus.java:106)
	... 11 common frames omitted
Caused by: org.janusgraph.core.JanusGraphException: Unexpected exception
	at org.janusgraph.graphdb.database.StandardJanusGraph.commit(StandardJanusGraph.java:802)
	at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.commit(StandardJanusGraphTx.java:1379)
	... 16 common frames omitted
Caused by: org.janusgraph.diskstorage.locking.PermanentLockingException: Local lock contention
	at org.janusgraph.diskstorage.locking.AbstractLocker.writeLock(AbstractLocker.java:327)
	at org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingStore.acquireLock(ExpectedValueCheckingStore.java:103)
	at org.janusgraph.diskstorage.keycolumnvalue.KCVSProxy.acquireLock(KCVSProxy.java:52)
	at org.janusgraph.diskstorage.BackendTransaction.acquireEdgeLock(BackendTransaction.java:237)
	at org.janusgraph.graphdb.database.StandardJanusGraph.prepareCommit(StandardJanusGraph.java:537)
	at org.janusgraph.graphdb.database.StandardJanusGraph.commit(StandardJanusGraph.java:717)
	... 17 common frames omitted

Am i using transaction incorrectly or grakn have some issue for concurrent transactions on the same data?

Thanks.


#2

Hi @julien

It could be either case. To make a judgement, we need to see how you’re using transactions. Can you share the code with us? You could also send it to me or Marco directly on Slack if it can’t be shared publicly,


#3

Hi @soroush

First, sorry to create question(s) with not a lot of information or repro cases. I have another open question in the forum that clearly require existing database and repro case.

We currently work hard to be able to give you some pre package platform with clear reprocase.

Thanks.