Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-02-2019 04:14 AM
Hi,
I have a server in which the connection is opened (python):
self._driver: Driver = GraphDatabase.driver(credentials["uri"], auth=(credentials["user"], credentials["password"]), max_connection_lifetime=3600*24*30, keep_alive=True)
I run some requests and it works all perfectly. The requests are run by using the function:
def __exe_query(self, query: str):
with self._driver.session() as session:
session.run(query).consume()
Despite these queries do not return anything relevant I added .consume() based on this post Error while loading data in Neo4j (Python Driver).
I wait 4-5 minutes (while the server is running waiting for other requests), I run the exact same requests, and I get the error:
"Failed to read from defunct connection Address(host='****', port=**)"
I also tried with max_connection_lifetime=-1.
I am working with python 3.7.0 with these libraries versions: neo4j==1.7.2 neobolt==1.7.9 neotime==1.7.4 as suggested by https://github.com/neo4j/neo4j-python-driver/issues/293.
It does not work in Win10 and Linux Ubuntu 18.04.3 LTS.
Thanks for your help and attention,
Vittorio
12-17-2019 05:00 AM
Can you provide the queries you're running? It might be an issue there.
01-10-2020 12:53 AM
Hi,
I'm facing the same issue - is there any progress on this topic?
Thanks.
BR,
Tobias
01-15-2020 07:44 AM
I solved the issue by creating a parallel thread which is scheduled to fire a query every 30s (add and delete a node). This is because, if the connection is idle for more than 2-3 minutes, it will be closed (from my understanding).
Hope that's help.
Vittorio
07-19-2020 07:43 PM
I had the same problem and basically tried all of the methods mentioned scattered over google, plus some others.
Used Neo4j instead of py2neo, using write_transaction. This didn't work
Set the max_connection_lifetime, keep_alive parameters etc. This didn't work
Setting a parallel thread to periodically create / delete nodes. This didn't work
Created a method that split files into temporary chunks instead of using PERIODIC COMMIT. This didn't work
I had previously noticed in the task manager that memory allocation dropped heavily just before this error appeared - I initially thought that this was a connection issue rather than memory issue... But lo and behold, updating the memory allocations in the Neo4j settings to higher values was the only thing that managed to prevent this error from occurring.
All the sessions of the conference are now available online