Skip to content

'Comparison method violates general contract' error in QueryGraph#lookup. #1582

Closed

Description

@easbar

When running random tests for #1581 the following error came up, see the modified test here:
eb37e7c

java.lang.IllegalArgumentException: Comparison method violates its general contract!

	at java.util.TimSort.mergeHi(TimSort.java:899)
	at java.util.TimSort.mergeAt(TimSort.java:516)
	at java.util.TimSort.mergeForceCollapse(TimSort.java:457)
	at java.util.TimSort.sort(TimSort.java:254)
	at java.util.Arrays.sort(Arrays.java:1512)
	at java.util.ArrayList.sort(ArrayList.java:1462)
	at java.util.Collections.sort(Collections.java:175)
	at com.graphhopper.routing.QueryGraph$3.apply(QueryGraph.java:277)
	at com.graphhopper.routing.QueryGraph$3.apply(QueryGraph.java:269)
	at com.carrotsearch.hppc.IntObjectHashMap.forEach(IntObjectHashMap.java:717)
	at com.graphhopper.routing.QueryGraph.lookup(QueryGraph.java:269)
	at com.graphhopper.routing.RandomCHRoutingTest.addVirtualNodesAndEdges(RandomCHRoutingTest.java:126)
	at com.graphhopper.routing.RandomCHRoutingTest.issue1574_random(RandomCHRoutingTest.java:78)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


Activity

  1. changed the title [-]Comparison method violates general contract error in QueryGraph#lookup.[/-] [+]'Comparison method violates general contract' error in QueryGraph#lookup.[/+] on Mar 28, 2019
  2. added a commit that references this issue on Apr 9, 2019
    470e06b
  3. michaz commented on Apr 9, 2019

    @michaz
    Member

    Nice catch. I took the liberty of fixing that on your branch. I think now the code does what the comment said it would do. ,-)

  4. easbar commented on Apr 9, 2019

    @easbar
    MemberAuthor

    Nice, thanks! Do you want to open a PR ? There is probably no need for the test case I added because it does many things not really related to this error.

  5. added this to the 0.13 milestone on Apr 12, 2019
  6. added a commit that references this issue on Aug 28, 2023
  7. added a commit that references this issue on Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions