Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Comparison method violates its general contract" in VisitorLogic.sweepCache #49

Closed
kno10 opened this issue Oct 2, 2016 · 1 comment
Assignees

Comments

@kno10
Copy link
Contributor

kno10 commented Oct 2, 2016

Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.ComparableTimSort.mergeLo(ComparableTimSort.java:744)
        at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:481)
        at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:406)
        at java.util.ComparableTimSort.sort(ComparableTimSort.java:213)
        at java.util.Arrays.sort(Arrays.java:1312)
        at de.fau.cs.osr.utils.visitor.VisitorLogic.sweepCache(VisitorLogic.java:225)
        at de.fau.cs.osr.utils.visitor.VisitorLogic.findVisit(VisitorLogic.java:205)
        at de.fau.cs.osr.utils.visitor.VisitorLogic.resolveAndVisit(VisitorLogic.java:105)

This is probably caused by multiple threads being used, and thus lastUse changing. The synchronization on sweepCache is not enough to prevent other threads from changing lastUse. It may be enough to just attempt to partially sort the targets to identify the least frequently used, rather than calling Arrays.sort. A quick select strategy may be worth trying. (Note: this bug likely doesn't appear in older Java versions, which did not use TimSort).

P.S. the osr-common repository, where this is supposed to be in, is currently empty.

@kno10
Copy link
Contributor Author

kno10 commented Nov 9, 2016

Migrated to: sweble/osr-common#1

@kno10 kno10 closed this as completed Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants