Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2484

The callable result retrieval fails in case of retry

    XMLWordPrintable

Details

    Description

      Hi,

      the issue is the following:

      1. There is a simple callable, which throws an exception. The class is written so that, the exception throwing part is configurable. After the first time the exception is thrown, the attribute is set so that, during 2nd execution, the normal value is returned.

      2. The callable is executed with DefaultExecutorService. During DistributedTask building, a custom newly created failoverPolicy is set to the task, which maxFailoverAttempts is set to 1.

      3. When the test run, first execution throws exception, then as the maxFailoverAttempts is set to 1, system retries to execution the callable once more. On the retry, the callable should return normal value. But instead, the following exception is thrown:

      "java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.innerGet(DefaultExecutorService.java:914) at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.get(DefaultExecutorService.java:874) at org.infinispan.distexec.BasicDistributedExecutorTest.testDistributedCallableCustomFailoverPolicySuccessfullRetry(BasicDistributedExecutorTest.java:353) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.retrieveResult(DefaultExecutorService.java:981) at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.innerGet(DefaultExecutorService.java:912) ... 23 more ... Removed 16 stack frames
      java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.innerGet(DefaultExecutorService.java:914) at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.get(DefaultExecutorService.java:874) at org.infinispan.distexec.BasicDistributedExecutorTest.testDistributedCallableCustomFailoverPolicySuccessfullRetry(BasicDistributedExecutorTest.java:353) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) at org.testng.internal.Invoker.invokeMethod(Invoker.java:715) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:907) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1237) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.access$000(SuiteRunner.java:37) at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368) at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.retrieveResult(DefaultExecutorService.java:981) at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.innerGet(DefaultExecutorService.java:912) ... 23 more "

      You can find the reproduction scenario here:
      https://github.com/andyuk1986/infinispan/blob/DIST_EXEC_TESTS/core/src/test/java/org/infinispan/distexec/BasicDistributedExecutorTest.java (testDistributedCallableCustomFailoverPolicySuccessfullRetry test)

      Attachments

        Activity

          People

            vblagoje Vladimir Blagojevic (Inactive)
            amanukya@redhat.com Anna Manukyan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: