aerospike

Aerospike java client RecordSet next function hang for infinite time after query a set


In java aerospike client 6.0.0, thread blocked for infinite time in records.next() call, however we have set totalTimeout in queryPolicy to 30 seconds. This even happened we don’t have any data in the set for a particular secondary index value. We didn’t get failures in query but application hang in recordSet next function. I am attaching the backtrace and code snippet, Kindly suggest the solution.

Code as follows:

Map<Key, Record> map = new HashMap<Key, Record>();
RecordSet records = null;
try {
    records = aerospike.getAerospikeClient().query(aerospike.getQueryPolicy(), stmt);;
    while(records!=null && records.next())
    {
        Record record = records.getRecord();
        Key key = records.getKey();
        map.put(key, record);           
    }
}

Exception trace as follows:

io.vertx.core.VertxException: Thread blocked at sun.misc.Unsafe.park(Native Method) ~[?:1.8.0_131] at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) ~[?:1.8.0_131] at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) ~[?:1.8.0_131] at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403) ~[?:1.8.0_131] at com.aerospike.client.query.RecordSet.next(RecordSet.java:66) ~[JioUdmProv.jar:?] at rjil.udmp.jioudmp.aerospike.AeroSpikeInterface.query(AeroSpikeInterface.java:546) ~[JioUdmProv.jar:?]

We tried totalTimeout to 30 seconds in query policy but it didn't worked.


Solution

  • May be worth checking with a more recent Java client version?

    Specifically wondering whether the following fix in version 6.1.6 may apply here:

    CLIENT-2112 Reset the foreground query “done” indicator before checking for errors in PartitionTracker.isComplete(). This resolves a potential hang when running queries that fail after multiple retryable errors.

    Also, realized that you had posted here too which has gotten some input: https://discuss.aerospike.com/t/java-thread-blocked-infinite-in-recordset-next-function-after-executing-query/10604