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

Crashes after media scanning: IllegalArgumentException: #641

Open
4 tasks done
fungs opened this issue Dec 20, 2023 · 3 comments
Open
4 tasks done

Crashes after media scanning: IllegalArgumentException: #641

fungs opened this issue Dec 20, 2023 · 3 comments
Assignees
Labels
bug Something isn't working critical Need to get this fixed right now music Related to music loading

Comments

@fungs
Copy link

fungs commented Dec 20, 2023

Describe the Bug/Crash

Start app, see bug report.

Describe the intended behavior

Not crash.

What android version do you use?

Android 10

What device model do you use?

Gigaset GS290 eOS

Bug report

Crashes at Startup after having completely scanned the library.

java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:777)
at java.util.TimSort.mergeAt(TimSort.java:514)
at java.util.TimSort.mergeCollapse(TimSort.java:439)
at java.util.TimSort.sort(TimSort.java:245)
at java.util.Arrays.sort(Arrays.java:1492)
at java.util.ArrayList.sort(ArrayList.java:1470)
at java.util.Collections.sort(Collections.java:206)
at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(Unknown Source:7)
at org.oxycblt.auxio.list.sort.Sort.songs(SourceFile:21)
at org.oxycblt.auxio.home.HomeViewModel.onMusicChanges(SourceFile:30)
at org.oxycblt.auxio.music.MusicRepositoryImpl.dispatchLibraryChange(Unknown Source:27)
at org.oxycblt.auxio.music.MusicRepositoryImpl$indexImpl$5.invokeSuspend(SourceFile:16)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
at kotlinx.coroutines.DispatchedTask.run(Unknown Source:107)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

Duplicates

@fungs fungs added the bug Something isn't working label Dec 20, 2023
@OxygenCobalt
Copy link
Owner

OxygenCobalt commented Dec 21, 2023

Have you tried disabling "Intelligent Sorting" in Settings -> Content? You should be able to do this before it crashes on a fresh install that's still taking awhile to load music @fungs. This would allow me to confirm what I think it is, that apparently the name comparison code that I do have really does require me to ensure that the comparison and equality results are 100% consistent.

@OxygenCobalt OxygenCobalt added the music Related to music loading label Dec 21, 2023
@fungs
Copy link
Author

fungs commented Dec 22, 2023

@OxygenCobalt, I can confirm that the intelligent sorting (excluding articles etc.) option seems to cause this issue. I disabled it on a fresh install, not running into that issue and enabled it again, which caused the same error.

@OxygenCobalt
Copy link
Owner

OxygenCobalt commented Dec 22, 2023

Alright, this implies something I feared would happen. The issue is that intelligent name comparison plays a tad loose with the sorting contract. If you have a name like "FooBar" and "Foo Bar", the comparator will consider those equal, but the actual equality check won't. I thought this was okay after reading the comparator contract documentation, but apparently not. Thanks for reporting this @fungs.

@OxygenCobalt OxygenCobalt added the critical Need to get this fixed right now label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical Need to get this fixed right now music Related to music loading
Projects
None yet
Development

No branches or pull requests

2 participants