[infinispan-issues] [JBoss JIRA] (ISPN-2496) Test for DistributedExecutionCompletionService hangs, if instantiation is done using PriorityBlockingQueue

Anna Manukyan (JIRA) jira-events at lists.jboss.org
Tue Nov 13 05:33:17 EST 2012


    [ https://issues.jboss.org/browse/ISPN-2496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12733637#comment-12733637 ] 

Anna Manukyan commented on ISPN-2496:
-------------------------------------

I think I've found why this issue happens. I tried to insert just a simple NotifyingFuture into PriorityBlockingQueue, and found out that the insertable future should be comparable. In my case it thrown ClassCastException. 

Then I took the line 61 of DistributedExecutionCompletionService into try-catch, and the following exception has been thrown:

java.lang.ClassCastException: org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart cannot be cast to java.lang.Comparable
	at java.util.concurrent.PriorityBlockingQueue.siftUpComparable(PriorityBlockingQueue.java:347)
	at java.util.concurrent.PriorityBlockingQueue.offer(PriorityBlockingQueue.java:475)
	at java.util.concurrent.PriorityBlockingQueue.add(PriorityBlockingQueue.java:449)
	at org.infinispan.distexec.DistributedExecutionCompletionService$QueueingListener.futureDone(DistributedExecutionCompletionService.java:62)
	at org.infinispan.distexec.DefaultExecutorService$DistributedTaskPart.notifyDone(DefaultExecutorService.java:949)
	at org.infinispan.remoting.rpc.RpcManagerImpl$1.call(RpcManagerImpl.java:297)
	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)

And the hangout takes place, because the take() method waits till there is one completed task in a completion queue and as the exception is thrown, it just enters into never ending loop.
                
> Test for DistributedExecutionCompletionService hangs, if instantiation is done using PriorityBlockingQueue
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: ISPN-2496
>                 URL: https://issues.jboss.org/browse/ISPN-2496
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Distributed Execution and Map/Reduce
>            Reporter: Anna Manukyan
>            Assignee: Vladimir Blagojevic
>
> Hi,
> while writing tests for DistributedExecutionCompletionService, the following issue arrised:
> I'm creating DistributedExecutionCompletionService with constructor:
>     DistributedExecutionCompletionService(DistributedExecutorService executor, BlockingQueue<NotifyingFuture<V>> completionQueue)
> If I'm passing as a completionQueue instance of ArrayBlockingQueue, then everything works properly. But if as a completionQueue I'm passing instance of PriorityBlockingQueue, then the test hangs.
> It hangs on line 61 of DistributedExecutionCompletionService:
>     completionQueue.add((NotifyingFuture<V>)future);
> You can find the test reproducing the issue here: 
> https://github.com/andyuk1986/infinispan/blob/DIST_EXEC_TESTS/core/src/test/java/org/infinispan/distexec/DistributedExecutionCompletionTest.java (testBasicInvocationWithBlockingQueue()).

--
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