cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to read from defunct connection (Jupyter notebook, python driver )

LJRB
Graph Buddy

I try to import data into a Neo4j VM in Azure.

This code works:

def create_article(tx):
    tx.run("CREATE (a:ARTICLE)")

session.read_transaction(create_article)

But this code doesn't work:

def create_node_article(tx, id, title, label):
    tx.run("CREATE (a:ARTICLE {id:$id, title:$title, label:$label})", id=id, title=title, label=label)

for index, row in df_article_ids.iterrows():
    session.read_transaction(create_node_article, row['id'], row['cleaned_best_title'], row['label'])

I have the error:

Transaction failed and will be retried in 1.0608892687544587s (Failed to read from defunct connection Address(host='IP', port=7687) (Address(host='IP', port=7687)))

I don't know what I have to change or check. I also tried Neo4j Desktop and I have the same error.

Neo4j version: 4.1.3

2 REPLIES 2

mark_needham
Neo4j
Neo4j

Could you include the full code sample that you're trying to get working?

Hello,

I have the same problem with the official Python Driver and Neo4j. I've been receiving this error: "Failed to read from defunct connection IPv4Address(('HOST', 7687)) (IPv4Address(('IPADDRESS', 7687)))"

It seems like there are already open GitHub issues for this, but there are no updates yet as far as I can tell.

Has anyone on this forum managed to solve this issue?

For me, I tend to see this error message particularly often on those days when my python code updates the Neo4j graph database with csv files around 1G or more. Based on what I read on those GitHub threads, at some point the Python driver loses the connection to Neo4j if a considerable amount of times has passed. But I still find that a bit odd because on other days the updates finish in about 6 hours so clearly the connection remains even after a couple of hours.

I'm going to try to increase the

max_connection_lifetime=200

parameter so that the connection is maintained longer but people are saying that does not solve the problem.

Thanks

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online