Connection closed after few minutes: defunct connection Address

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:

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
It does not work in Win10 and Linux Ubuntu 18.04.3 LTS.

Thanks for your help and attention,

Can you provide the queries you're running? It might be an issue there.


I'm facing the same issue - is there any progress on this topic?



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.