I am building an application that needs to execute lots of Cypher statements against Neo4j. I execute these statements in 10K batches and commit them, however I often run into an error:
Supplied bookmark does not conform to pattern neo4j:bookmark:v1:tx
I am not sure what to do about it and I don't know why it is occurring. Here is the snippet of code that is executing the statements:
with driver.session() as session:
# _batch_statements just yields batches of 10K cypher statements from the list statements
for batch in _batch_statements(statements):
with session.begin_transaction() as tx:
for statement in batch:
tx.run(statement)
tx.commit()
Anyone have any ideas as to why this would happen? any potential solutions?
Looking at the neo4j debug log and comparing it to my application's log this error seems to coincide with the errors above:
ERROR [o.n.b.r.DefaultBoltConnection] Protocol breach detected in bolt session 'bolt-0'. Message 'ROLLBACK' cannot be handled by a session in the READY state.
org.neo4j.bolt.runtime.BoltProtocolBreachFatality: Message 'ROLLBACK' cannot be handled by a session in the READY state.
at org.neo4j.bolt.runtime.statemachine.impl.AbstractBoltStateMachine.nextState(AbstractBoltStateMachine.java:148)
at org.neo4j.bolt.runtime.statemachine.impl.AbstractBoltStateMachine.process(AbstractBoltStateMachine.java:91)
at org.neo4j.bolt.messaging.BoltRequestMessageReader.lambda$doRead$1(BoltRequestMessageReader.java:90)
at org.neo4j.bolt.runtime.DefaultBoltConnection.lambda$enqueue$0(DefaultBoltConnection.java:148)
at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatchInternal(DefaultBoltConnection.java:237)
at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:172)
at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:162)
at org.neo4j.bolt.runtime.scheduling.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:246)
at org.neo4j.bolt.runtime.scheduling.ExecutorBoltScheduler.lambda$scheduleBatchOrHandleError$3(ExecutorBoltScheduler.java:229)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)
Another update: Previous executions were run from a docker container neo4j running on a laptop. I went ahead and executed the exact same code against a neo4j instance running on a server with a lot of resources and it all executed just fine. Maybe this is a resource utilization issue?
I've also seen this error -- for the first time, recently. And, this is a recent post. What is the server version? Mine is (now) 4.1.0, and so I wonder if the python driver isn't in sync with the new server version.
Sorry for the delayed response! I am leaning toward a driver compatibility issue as well. Ran the tool again on the laptop with the same version of Neo4j as the server and it all executed as expected. Looks like I will need to be updating my tool to work with the 4.0 driver soon. Thanks all!