NullReferenceException when executing a query after a failed reconnect.
gjhommersom opened this issue · comments
gjhommersom commented
Steps to reproduce:
- Connect with RethinkDb.
- Stop the RethinkDb service.
- Execute a query.
- Do a reconnect.
- Execute a query.
Expected result:
A ReqlError indication that there is no active connection.
Actual result:
A NullReferenceException.
Other information:
The exception occurs because the pump is not set due to reconnect failing. Checking if the connection is open would fix this problem.
Affected code:
public virtual Task<Response> SendQuery(long token, string json, bool awaitResponse, CancellationToken cancelToken)
{
cancelToken.ThrowIfCancellationRequested();
if( pump.IsCancellationRequested )
{
throw new ReqlDriverError($"Threads may not {nameof(SendQuery)} because the connection is shutting down.");
}
...
}