aerospike / aerospike-client-csharp

Aerospike C# Client Library
70 stars 48 forks source link

Set failOnClusterChange = true in QueryPolicy cause "Error -1,1,1000,1000,2: Object reference not set to an instance of an object." #58

Closed ElegantElephant44 closed 3 years ago

ElegantElephant44 commented 3 years ago

I use query policy with condition _queryPolicy = new QueryPolicy(_client.QueryPolicyDefault) { failOnClusterChange = true }; And during executing _client.Query(_queryPolicy, new RecordSequenceHandler(tcs), queryParameters); I get "Error -1,1,1000,1000,2: Object reference not set to an instance of an object." I've investigated the source code, and NullReference is produced in class AsyncCommand method ExecuteCommand() in

   node = (AsyncNode)GetNode(cluster);
   eventArgs.RemoteEndPoint = node.address;

node is null. Because in AsyncMultiExecutor method

public void ExecuteValidate(AsyncMultiCommand[] commands, int maxConcurrent, string ns)
{
    this.commands = commands;
    this.maxConcurrent = (maxConcurrent == 0 || maxConcurrent >= commands.Length) ? commands.Length : maxConcurrent;
    this.ns = ns;

    AsyncQueryValidate.ValidateBegin(cluster, new BeginHandler(this, commands, this.maxConcurrent), commands[0].node, ns);
}

commands[0].node is null, it has set commands[0].serverNode My package version is Aerospike.Client 3.9.9, but I have the same problem on version 4.1.0

BrianNichols commented 3 years ago

This is a bug. C# client 4.1.1 will fix your problem:

https://www.aerospike.com/download/client/csharp/notes.html#4.1.1