-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
Describe the bug
In normal operation, our API container app's graph queries began to fail with an ObjectDisposedException
, stack trace:
System.ObjectDisposedException: Cannot access a closed Stream.
Object name: 'NetworkStream'.
at AsyncTransaction.TransactionConnection.OnErrorAsync(Exception error)
at Connector.DelegatedConnection.SyncAsync()
at Protocol.BoltProtocolV3.RollbackTransactionAsync(IConnection connection)
at Internal.AsyncTransaction.RollbackAsync()
at Internal.AsyncTransaction.RollbackAsync()
at <>c__DisplayClass54_0`1.<<RunTransactionAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Internal.AsyncRetryLogic.RetryAsync[T](Func`1 runTxAsyncFunc)
at Logging.DriverLoggerUtil.TryExecuteAsync[T](ILogger logger, Func`1 func, String message)
at Internal.Driver.ExecuteQueryAsyncInternal[T](Query query, QueryConfig config, CancellationToken cancellationToken, Func`3 cursorProcessor)
at Internal.Driver.ExecuteQueryAsyncInternal[T](Query query, QueryConfig config, CancellationToken cancellationToken, Func`3 cursorProcessor)
at Internal.Driver.GetRowsAsync(Query query, QueryConfig config, Action`1 streamProcessor, CancellationToken cancellationToken)
at Internal.ReducedExecutableQuery`3.ExecuteAsync(CancellationToken token)
at OurNamespace.OurGraphManager.RunGraphQueryAsync(String query, Dictionary`2 parameters)
...
In our code, we open and persist a driver connection as:
...
_driver = GraphDatabase.Driver(uri, AuthTokens.Basic(configValues.Username, configValues.Password));
await _driver.VerifyConnectivityAsync();
and then make calls using this instance throughout the lifetime of the application:
IDriver conn = await GetConnectionAsync();
var results =
await conn
.ExecutableQuery(query)
.WithParameters(parameters)
.WithMap(record => GetNodeFromRecord(record))
.ExecuteAsync();
To Reproduce
Unfortunately I have been unable to reproduce this on demand, as it happened seemingly without obvious cause.
Expected behavior
DB connection continues to work as usual.
The stack trace indicates that the fault is internal to the driver. Even if the server connection had failed, the connection pool should handle this and replace it with a new connection instead of multi-disposing any resources.
Version Info (please complete the following information):
- .NET Version: .NET 8
- .NET Driver Version: v5.28.1
- Server: non-Neo4j, Bolt-compatible server