Any chance this is a hidden issue in the way Session.java acquires and releases the semaphores?
private static ListenableFuture<ResultSet> throttle(DoUnderThrottle doUnderThrottle,
Semaphore overallSemaphore) throws Exception {
overallSemaphore.acquire();
SettableFuture<ResultSet> outerFuture = SettableFuture.create();
ResultSetFuture innerFuture;
try {
innerFuture = doUnderThrottle.execute();
} catch (Throwable t) {
overallSemaphore.release();
throw t;
}
Futures.addCallback(innerFuture, new FutureCallback<ResultSet>() {
@Override
public void onSuccess(ResultSet result) {
overallSemaphore.release();
outerFuture.set(result);
}
@Override
public void onFailure(Throwable t) {
overallSemaphore.release();
outerFuture.setException(t);
}
}, MoreExecutors.directExecutor());
return outerFuture;
}
The release of semaphore normally relies on the call back. Is it a chance that the call backs are not called in time? Or the executor is not executing the async call at all for some reason?