cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Supplied Bookmark Does Not Conform to Pattern Error

Hello everyone,

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?

1 ACCEPTED SOLUTION

Yeah, "pip uninstall neotime neo4j neobolt" then "pip install neo4j" was the winner. Thanks.

For anyone else headed this way, some methods have changed, but wasn't too terrible to update code.

View solution in original post

8 REPLIES 8

I have been doing more testing and it appears there is a second error thrown as well:

Failed to read from defunct connection Address(host='localhost', port=7687) (Address(host='127.0.0.1', port=7687))

Both of these errors are thrown as the same time.

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?

It might be, another thing I would check is server versions and bolt driver versions and make sure they match.

Yeah, "pip uninstall neotime neo4j neobolt" then "pip install neo4j" was the winner. Thanks.

For anyone else headed this way, some methods have changed, but wasn't too terrible to update code.

Thanks for the confirmation and documenting it here!

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!

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online