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.

Debugging neobolt.exceptions.ServiceUnavailable error

Rogie
Node Link

Hello, I seem to be running into the following error and can't pinpoint the cause:

neobolt.exceptions.ServiceUnavailable: Failed to read from defunct connection Address(host='localhost', port=7687) (Address(host='127.0.0.1', port=7687))

My general workflow is something like this:

uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", mypass))
db = driver.session()
with db.begin_transaction() as tx:
    for d in my_data:
        q = get_query(d)
        tx.run(q)
        tx.success = True
driver.close()

The code runs fine for a while, and several nodes and relationships are successfully added to the graph. But then I will randomly get the error pasted above. Is there anything unusual in my code snippet? What might be the cause of the above error?

2 REPLIES 2

I am having the same issue, it seems like the connection to the neo4j database get's cancelled after a while. I am looking for a way to keep the connection open or reopen the connection after closure

olivier
Node Link

Hello,

I had the same problem. Looking at https://neo4j.com/docs/driver-manual/current/session-api/simple/#driver-simple-transaction-fn gave me a way to change my code.

Hope this helps...