.NET DRIVER - Failed to acquire a connection from connection pool for server with URI as this server has already been removed from routing table. Please retry your query again and you should be routed with a different server from the new routing table

Hi All,

We are facing this error consistently when connecting to Neo4j Causal Cluster from .NET Core using the .NET Driver.

Failed to acquire a connection from connection pool for server with URI as this server has already been removed from routing table. Please retry your query again and you should be routed with a different server from the new routing table. You should not see this error persistently

We have added the driver as a singleton and are using the IDriver through dependency injection :

services.AddSingleton(GraphDatabase.Driver(uri, AuthTokens.Basic(user, password), o => o.WithLogger(new Neo4jLogger())));

Could someone please help.

Best Regards,
Kshitiz Arora

1 Like

Hi Kshitiz,

This error indicates that a routing table update has occurred, which will be sent by the cluster if there has been a change to it's 'layout'. For example if a server has gone off line or is restarting. Retrying the query should solve the problem as it will establish a connection with a new server in the routing table. Are you using AutoCommit or transaction functions when running the query, e.g. session.RunAsync or session.ReadTransaction/session.BeginTransaction?

Hi @AndyHeap-NeoTec ,

Thanks a lot for you reply.

Please find below the session and transaction creation :

session = _driver.AsyncSession(action => action.WithDatabase(dbName)));

//In case of read
await session.ReadTransactionAsync(async transaction =>

//in case of write
await session.WriteTransactionAsync(async transaction =>

Hi Kshitiz,

The code usage looks correct. Is the error constant and preventing any transactions from being run, or is it occasionally appearing and then stopping?

Thanks
Andy