Retry InterruptedException

Posted by martinmr:

I am running the Jepsen tests and some of the tests are failing with this error:

ERROR [2020-07-01 22:11:46,650] ForkJoinPool.commonPool-worker-4 - io.dgraph.DgraphAsyncClient The doRequest got interrupted:
java.lang.InterruptedException: null
        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:347) ~[na:1.8.0_222]
        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895) ~[na:1.8.0_222]
        at io.dgraph.DgraphAsyncClient.lambda$runWithRetries$2(DgraphAsyncClient.java:180) ~[dgraph4j-2.0.2.jar:na]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) ~[na:1.8.0_222]
        at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582) ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[na:1.8.0_222]

The relevant section in the code (in DgraphAsyncClient) is:

 try {
            return ctxCallable.call().get();
          } catch (InterruptedException e) {
            LOG.error("The " + operation + " got interrupted:", e);
            throw new RuntimeException(e);
          } catch (ExecutionException e) {
            if (ExceptionUtil.isJwtExpired(e.getCause())) {
              try {
                // retry the login

I think InterruptedException should cause the operation to be retried to make the Jepsen tests more resilient.

abhimanyusinghgaur commented :

Closing this as Jepsen may be causing the interrupted exception, and we should not change the client behaviour for that as once interrupted, the client should just terminate as soon as possible.