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

DistributedTaskPart get(timeout, TimeUnit) throws ClassCastException in case the execution is not finished after specified time

    XMLWordPrintable

Details

    Description

      The issue appears almost every time the test is executed.

      The case is the following:
      1. Callable<Integer> is submitted to DistributedExecutorService for execution;
      The callable body consists of simple Thread.sleep(time) which makes the callable to sleep for specific period of time.

      2. Result is taken with get(long timeout, TimeUnit unit) method;
      The timeout is given so that, it is much more shorter than the sleeping time of the callable. But sometimes it happens, that the get(timeout, unit) waits till the end. I guess this happens due to priority of threads.

      3. In case of expected execution flow, i.e. if the method execution takes longer than the specified timeout, the following exception is thrown:

      java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.Map
      at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.retrieveResult(DefaultExecutorService.java:882)
      at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.get(DefaultExecutorService.java:818)
      at org.infinispan.distexec.DistributedExecutorTest.testSleepingCallableWithTimeoutOption(DistributedExecutorTest.java:336)
      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:74)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:673)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
      at org.testng.TestRunner.runWorkers(TestRunner.java:1147)
      at org.testng.TestRunner.privateRun(TestRunner.java:749)
      at org.testng.TestRunner.run(TestRunner.java:600)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:317)
      at org.testng.SuiteRunner.access$000(SuiteRunner.java:34)
      at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:351)
      at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:147)
      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)

      The pull request which contains tests reproducing/verifying the issue, is: https://github.com/infinispan/infinispan/pull/1425

      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: