Description
Reported by Mauricio Garavaglia on the dev list:
Hi guys,
There seems to be a bug in this comparator in PreemptionVictimFilter (
https://github.com/apache/aurora/blob/master/src/main/java/org/apache/aurora/scheduler/preemptor/PreemptionVictimFilter.java#L142)
because the comparator doesn’t satisfy transitivity, which is required by
Array.sort's Tim Sort implementation. This fails with a
"java.lang.IllegalArgumentException: Comparison method violates its general
contract!" from time to time.For example this input of A, B, and C doesn't work in the current
comparator.A: <1, 1, 1>
B: <2, 2, 2>
C: <0, 2, 1>Based on the comparator:
B > A
B == C
C == AConstructs impossible situation where C == B > A == C. As a workaround we
patched to simply sort based on RAM, but anyone have any suggestions about
what a permanent fix for upstream should be? Thanks
A likely culprit is that the filter does not handle comparison of tasks containing different ResourceTypes.
Attachments
Issue Links
- relates to
-
AURORA-1949 PreemptionVictimFilterImpl comparator violates transitivity causing exceptions
- Resolved