Java thread blocked infinite in recordSet.next function after executing query

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:?]

Cross posted at Aerospike java client RecordSet next function hang for infinite time after query a set - Stack Overflow.

Please try your code using java client 6.1.11. There were some query fixes that occurred since java client 6.0.0. Also, it’s important to close the RecordSet after the query completes and it’s not necessary to check RecordSet instance for null.

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

Thanks for the response. We have deployed the fix and its being tested. I will update if any threads block again.