Closed thhave closed 2 years ago
same thing.
I suppose the following race condition is possible.
Thread 1: ScheduleCommand() is called and argsQueue.TryDequeue() succeeds.
Thread 2: ScheduleCommand() is called and argsQueue.TryDequeue() fails. The command is added to the delayQueue before thread 1 checks if delayQueue is empty.
Thread 1: delayQueue empty check fails and the command is ignored.
I will investigate a cleaner solution. At a minimum, all unexpected edge cases should result in an exception and not a silent ignoring of the command.
C# client 4.2.6 is released: https://download.aerospike.com/download/client/csharp/notes.html#4.2.6
This should fix the race condition.
Thanks, seems to work fine
Hi folks! We've got a trouble with AsyncClient when using MaxCommandAction.DELAY. Sometimes our code hangs when operating huge amount of records in an asynchronous manner. We think that the issue is in how AsyncCommandDelayingQueue schedules incoming commands.
Let's look at source code of AsyncCommandDelayingQueue: https://github.com/aerospike/aerospike-client-csharp/blob/88a10b0f547bfd6515145d3e265c35cbda77c239/Framework/AerospikeClient/Async/AsyncCommandDelayingQueue.cs#L59-L77 There's a place where a passed command can be lost (maybe an exception should be thrown there?):
In some cases it can occur and it seems that we have encountered it in production when there's not enough available connections to process commands.
We use TaskCompletionSource to wait for all operations to finish:
Using:
If at least one command is lost a completion task won't be resolved at all (but can be cancelled if we pass cancellation token).
Client policy:
Aerospike.Client 4.2.4 aerospike-server:5.6.0.9