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.

py2neo: ServiceUnavailable: Cannot connect to any known routers after some hours

Hi Everyone,
I have created a flask application which connects to Neo4j AuraDB Free graph database instance. I have a global Graph instance which connects my neo4j db. I have the below configuration in my code.

Graph("neo4j+ssc://3951eb3f.databases.neo4j.io:7687",
                        auth=('neo4j', <password>),
                        name='neo4j', secure=True, routing=True) 

I'm using python 3.7.8 and py2neo 2021.2.3.

It works fine for 8 hours or so. After that I start to see an error message py2neo.errors.ServiceUnavailable: Cannot connect to any known routers. If I restart my flask server it starts working fine. I really need help in fixing this issue.
Here is the error stack:

  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\database.py", line 518, in query
    result = self.auto(readonly=True).run(cypher, parameters)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\database.py", line 991, in run
    readonly=self.readonly)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\client\__init__.py", line 1338, in auto_run
    cx = self._acquire(graph_name)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\client\__init__.py", line 1111, in _acquire
    return self._acquire_rw(graph_name)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\client\__init__.py", line 1203, in _acquire_rw
    ro_profiles, rw_profiles = self._get_profiles(graph_name, readonly=False)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\client\__init__.py", line 1016, in _get_profiles
    self.refresh_routing_table(graph_name)
  File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-packages\py2neo\client\__init__.py", line 1064, in refresh_routing_table
    raise ServiceUnavailable("Cannot connect to any known routers")
py2neo.errors.ServiceUnavailable: Cannot connect to any known routers
2 REPLIES 2

TrevorS
Community Team
Community Team

Hello @Ashwath 

Thank you for reaching out! Have you been able to resolve this issue yet?
If you have, please reply back with your solution so I can mark it as the solution.

if you are still having trouble, I would recommend opening a ticket at https://github.com/neo4j and include a link to your ticket here.

Thanks!

TrevorS
Community Specialist

Also, this github link may help out as well!
https://github.com/py2neo-org/py2neo

TrevorS
Community Specialist