Merged latest eclipse/main updates to downstream - #103
Merged
Merged
Conversation
the old code subtracted the millisecond representation of the time points from one another and cast the result to an int which may have silently led to an overflow in case the difference between the time points was greater than 49 days. For races with open-ended tracking time ranges and sporadic fixes along that full time range may have caused problems here.
The StartAndEndAwareTimeBasedCandidateComparator compared candidate time points with (int) (o1.getTimePoint().asMillis() - o2.getTimePoint().asMillis()). Epoch milliseconds are ~1.7e12, so for candidates more than Integer.MAX_VALUE ms (~24.8 days) apart the 64-bit difference is truncated to 32 bits and its sign can flip, turning the comparator into a non-total order. On the "my" server this pinned all background-executor threads in TreeSet/NavigableSet navigation and starved the maneuver-calculation queue (live candidate set span was ~355.9 days, 14.3x the int limit). CandidateComparatorOverflowTest reproduces the mechanism in isolation against plain long epoch millis, independent of any domain type: - truncatingCastReportsACyclicOrder: a single >2^31 ms step overflows and flips the sign, producing the cycle T_LOW > T_MID > T_HIGH > T_LOW. - treeSetNavigationIsConsistentOnlyWithFixedComparator: the broken order makes TreeSet first()/last() disagree with the true chronological extremes. - convergenceLoopTerminatesOnlyWithFixedComparator: an updateCandidates-shaped loop over a realistically sized multi-cluster set never drains under the buggy comparator (hits a 1,000,000-iteration cap) but drains in ~50 passes with Long.compare. Assisted-By: Claude Opus 4.8 (Claude Code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated merge of upstream
eclipse/main(and re-sync of downstream) intoSAP/sailing-analytics:main.Incoming commits (4)