[infinispan-issues] [JBoss JIRA] (ISPN-2451) DefaultExecutorService invokeAny(Collection tasks, long timeout, TimeUnit unit) waits till the task execution even if the timeout exceeds

Anna Manukyan (JIRA) jira-events at lists.jboss.org
Mon Oct 29 12:30:01 EDT 2012


Anna Manukyan created ISPN-2451:
-----------------------------------

             Summary: DefaultExecutorService invokeAny(Collection tasks, long timeout, TimeUnit unit) waits till the task execution even if the timeout exceeds
                 Key: ISPN-2451
                 URL: https://issues.jboss.org/browse/ISPN-2451
             Project: Infinispan
          Issue Type: Bug
            Reporter: Anna Manukyan
            Assignee: Mircea Markus


Hi,

I've written some new tests for DefaultExecutorService for both testing the product as well as for increasing the coverage and I have some strange behaviour which I don't know whether related to concurency non-reliability or it is a bug.

I have a Callable which just sleeps for 10 seconds and the returns 1. And I have a test, which submits the callable to DefaultExecutorService with invokeAny(collection, timeout, TimeUnit) method, and passes as a parameter to the method 2 seconds. As far as I understand, this means that if the execution of any of the tasks will not complete in 2 seconds, the Timeout exception should be thrown.

But everytime I run the test, the TimeoutException is thrown only once maybe in 5 executions. The exception is:

org.testng.TestException: 
Expected exception java.util.concurrent.TimeoutException but got org.testng.TestException: 
Method org.infinispan.distexec.DistributedExecutorTest.testInvokeAnyTimedSleepingTasks() should have thrown an exception of class java.util.concurrent.TimeoutException
	at org.testng.internal.Invoker.handleInvocationResults(Invoker.java:1416)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1184)
	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)
Caused by: org.testng.TestException: 
Method org.infinispan.distexec.DistributedExecutorTest.testInvokeAnyTimedSleepingTasks() should have thrown an exception of class java.util.concurrent.TimeoutException
	at org.testng.internal.Invoker.handleInvocationResults(Invoker.java:1442)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:722)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
	... 12 more

You can find the test here:

https://github.com/andyuk1986/infinispan/blob/dist_exec_tests/core/src/test/java/org/infinispan/distexec/DistributedExecutorTest.java 

the test case is: testInvokeAnyTimedSleepingTasks()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the infinispan-issues mailing list