cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Neo4j connection issues via py2neo

I am newbie in neo4j. I am unable to figure out the issue.

So, I have a flask app that connects to neo4j db (using py2neo) like following

neo4j_instance = Graph(uri, auth=(secrets['neo4j_username'], secrets['neo4j_password']))

however some calls to neo4j ends up being pretty long.. So, that was rendering my flask app unstable.
So, I decided to put all these calls as async calls and added a timeout..
Like..

graph.run(query)
to 
async_result = pool.apply_async(graph.run, (query,))
async_result.get(timeout=1)

But now, I am observing connection to neo4j in weird state.

2021-03-17T05:34:57.187821830Z Connection to ConnectionProfile('bolt://neo4j@host:port') broken
2021-03-17T05:34:57.187893730Z Wire broken after 946.9s idle (4095 bytes sent, 1470 bytes received)

I don't see any "errors" just these warnings.. but whenever i see this, no data is being returned..
I have tried to "refresh" connection (by connecting to neo4j every 5 minutes but still doesn't resolves the issue)

Not sure if what I am seeing is the issue.. but why is neo4j not returning anything. How do I fix this?

1 REPLY 1

ehume123
Node Clone

Hi MSingh, are you using bolt protocol to setup neo4j in python?