Community
Participate
Working Groups
Typinng some search characters in the "Open Resource" dialog (CTRL-SHIFT-R), I suddently got a "Comparison method violates its general contract!" error popup. Here's the stack trace: !ENTRY org.eclipse.core.jobs 4 2 2018-07-25 22:38:39.711 !MESSAGE An internal error occurred during: "Items filtering". !STACK 0 java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeForceCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.ArrayList.sort(Unknown Source) at java.util.Collections$SynchronizedList.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.getSortedItems(FilteredItemsSelectionDialog.java:2701) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.rememberResult(FilteredItemsSelectionDialog.java:2714) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.filterContent(FilteredItemsSelectionDialog.java:2054) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.internalRun(FilteredItemsSelectionDialog.java:1998) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.doRun(FilteredItemsSelectionDialog.java:1970) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.run(FilteredItemsSelectionDialog.java:1957) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
What's the build ID (Help > About Eclipse)?
Build id: 20180619-1200
Lucas, can you take a look?
Yup. Do you remember what you were typing/what files you had in your workspace?
I think I typed some random characters as I was not looking specifically something but was playing wihth the feature. Also I think it happened after several searches in the same dialog. Interestingly, I managed to reproduce it after a few searches and agin on random characters after just about 1 minute (these time it is "Cache Refresh"): !ENTRY org.eclipse.core.jobs 4 2 2018-07-26 14:58:06.641 !MESSAGE An internal error occurred during: "Cache refresh". !STACK 0 java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeForceCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.ArrayList.sort(Unknown Source) at java.util.Collections$SynchronizedList.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.getSortedItems(FilteredItemsSelectionDialog.java:2701) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.getFilteredItems(FilteredItemsSelectionDialog.java:2840) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.reloadCache(FilteredItemsSelectionDialog.java:2774) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog.reloadCache(FilteredItemsSelectionDialog.java:969) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$RefreshCacheJob.run(FilteredItemsSelectionDialog.java:1456) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60) I'm going to check if I can reproduce it reliably and report. My workspace is huge with about 60 opened projects, mostly Java and xml files.
Ok this helps, I'll get to this later today.
Ok, I reproduced it 5 times in a row, each crash happening 3-4 searches appart from the other. Searches making it crash seems random: can be 3 letters or just even 1 letter so I so not think it is related to the search term. It's really non deterministic: sometimes there is no crash doing many searches for 1 or 2 minutes then you get a few crashes in quick succession... It's possible you can reprod it with a huge workspace, issuing fast searches in succession, using backspace to clear text. I've also seen it crash with the search textfield empty !
I know can reproduce it very easily seaching alternatively for "cd" and "ds" That is, typing: c d backspace backspace d s backspace backspace c d ... These 2 searches have many results. The crash never happens if I alternate search of just 1 char: "c" and "d".
After making quite the typing storm was able to replicate issue in I20180725-2000. Looking for solution.
New Gerrit change created: https://git.eclipse.org/r/126669
@Mchael would you be able to test the patch with your workspace since you are able to more consistently cause the flaw?
I can test it if you provide me an updated jar that I can temporily replace in my Photon install. Not too keen on loading my workspace on a full newer Eclipse version.
Don't know if that will work as I am unable to get the same build as you (feel free to correct me @Dani). You could download the patch and test it in a child eclipse then import the same projects as your current workspace to test it
I spent a lot of time migrating this rather complex workspace from Mars to Photon recently and do not want to import it in another version in fear of possibly breaking stuff.
(In reply to Lucas Bullen from comment #13) > Don't know if that will work as I am unable to get the same build as you > (feel free to correct me @Dani). You would have to create the plug-in JAR and then replace the version in the manifest and the JAR name with the one from Michael. That should work.
@Mchael, can you go to your eclipse/plugins/ folder and tell my what the name of your org.eclipse.ui.workbench_3.112.0.v{date}.jar file is so I can create the jar?
It's current Photon stable release (notice 3.111 instead of 3.112): org.eclipse.ui.workbench_3.111.0.v20180524-1156.jar
Created attachment 275166 [details] org.eclipse.ui.workbench_3.111.0.v20180524-1156 Give that a try.
Lucas, The crash is still happening easily with the new version, alternating searches for cd and df. I've triple checked that your updated jar was used, also confirmed with Collection.sort() being called at line 2699 (while 2701 in initial report). /// !ENTRY org.eclipse.core.jobs 4 2 2018-07-27 22:56:38.697 !MESSAGE An internal error occurred during: "Items filtering". !STACK 0 java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeHi(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.ArrayList.sort(Unknown Source) at java.util.Collections$SynchronizedList.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.getSortedItems(FilteredItemsSelectionDialog.java:2699) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$ContentProvider.rememberResult(FilteredItemsSelectionDialog.java:2712) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.filterContent(FilteredItemsSelectionDialog.java:2052) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.internalRun(FilteredItemsSelectionDialog.java:1996) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.doRun(FilteredItemsSelectionDialog.java:1968) at org.eclipse.ui.dialogs.FilteredItemsSelectionDialog$FilterJob.run(FilteredItemsSelectionDialog.java:1955) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
(In reply to Mchael Pujos from comment #19) > Lucas, > > The crash is still happening easily with the new version, alternating > searches for cd and df. Thanks for testing the fix Mchael. Lucas, maybe you print something to the console with your next fix, so that we are 100% sure the fixed plug-in was used.
New Gerrit change created: https://git.eclipse.org/r/126732
(In reply to Eclipse Genie from comment #21) > New Gerrit change created: https://git.eclipse.org/r/126732 This should fix it. The code used *volatile* search patterns during sort, so if pattern changed while sort was in progress => kaboom. Can be easily reproduced in debugger by modifying the code in the way that it throws exception if the pattern we saw at the comparator creation was not the same we see at compare() time.
Gerrit change https://git.eclipse.org/r/126732 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=0d78f515835777958786176a21d6e83d070b15f1