You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Cameron McKenzie (JIRA)" <ji...@apache.org> on 2014/06/19 03:14:24 UTC

[jira] [Commented] (CURATOR-115) delayeddistributedqueue failed to sort children

    [ https://issues.apache.org/jira/browse/CURATOR-115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14036784#comment-14036784 ] 

Cameron McKenzie commented on CURATOR-115:
------------------------------------------

Pretty sure this is occurring because the sortChildren() method does a comparison using the current time which will change as the sort is occurring. This means that it will be possible for the Comparator implementation to break it's transitivity contract (i.e If A > B and B > C then A > C). I haven't managed to reproduce the problem though, so I can't confirm that this is indeed the issue. If it is, determining the current time at the start of the sort and then using that for all comparisons should fix it.

> delayeddistributedqueue failed to sort children
> -----------------------------------------------
>
>                 Key: CURATOR-115
>                 URL: https://issues.apache.org/jira/browse/CURATOR-115
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.4.2
>         Environment: linux, jdk 7
>            Reporter: kimi
>
> i have a delayeddistributed queues to store some jobs, on startup, sometimes this issue come up:
> recipes.queue.DistributedDelayQueue$1-QueueBuilder-5 [ERROR] Exception caught in background handler
> java.lang.IllegalArgumentException: Comparison method violates its general contract!
>         at java.util.TimSort.mergeLo(TimSort.java:747)
>         at java.util.TimSort.mergeAt(TimSort.java:483)
>         at java.util.TimSort.mergeCollapse(TimSort.java:408)
>         at java.util.TimSort.sort(TimSort.java:214)
>         at java.util.TimSort.sort(TimSort.java:173)
>         at java.util.Arrays.sort(Arrays.java:659)
>         at java.util.Collections.sort(Collections.java:217)
>         at org.apache.curator.framework.recipes.queue.DistributedDelayQueue$1.sortChildren(DistributedDelayQueue.java:89)
>         at org.apache.curator.framework.recipes.queue.DistributedQueue.runLoop(DistributedQueue.java:551)
>         at org.apache.curator.framework.recipes.queue.DistributedQueue.access$000(DistributedQueue.java:65)
>         at org.apache.curator.framework.recipes.queue.DistributedQueue$1.call(DistributedQueue.java:196)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:744)



--
This message was sent by Atlassian JIRA
(v6.2#6252)