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( ~[na:1.8.0_222]
        at java.util.concurrent.CompletableFuture.get( ~[na:1.8.0_222]
        at io.dgraph.DgraphAsyncClient.lambda$runWithRetries$2( ~[dgraph4j-2.0.2.jar:na]
        at java.util.concurrent.CompletableFuture$ ~[na:1.8.0_222]
        at java.util.concurrent.CompletableFuture$AsyncSupply.exec( ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinTask.doExec( ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask( ~[na:1.8.0_222]
        at java.util.concurrent.ForkJoinPool.runWorker( ~[na:1.8.0_222]
        at ~[na:1.8.0_222]

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

 try {
          } 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.