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

Full cache reload after 3.5.0 crashes #810

Closed
JRDetwiler opened this issue Jun 26, 2024 · 18 comments
Closed

Full cache reload after 3.5.0 crashes #810

JRDetwiler opened this issue Jun 26, 2024 · 18 comments
Labels
bug Something isn't working critical Need to get this fixed right now music Related to music loading

Comments

@JRDetwiler
Copy link

It tried to fully reload my library and I got

java.lang.Exception: DeviceLibrary creation failed: java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at org.oxycblt.auxio.music.MusicRepositoryImpl$indexImpl$deviceLibraryJob$1.invokeSuspend(SourceFile:92)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Unknown Source:6)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(SourceFile:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:31)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:94)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:92)
@denny466
Copy link

Hi! I'm getting the same error & log after updating 3.4.3 to 3.5.0. Rolled back to 3.4.3 and all 15680 songs loaded successfully. Can you reproduce @OxygenCobalt or do i offer some samples?

@OxygenCobalt
Copy link
Owner

Please use this debug APK and report the updated stack trace @denny466 @JRDetwiler, I need it to determine the exact location of the error

Auxio_Canary.zip

@OxygenCobalt OxygenCobalt pinned this issue Jun 26, 2024
@denny466
Copy link

denny466 commented Jun 26, 2024

@OxygenCobalt Music loading failed

java.lang.Exception: DeviceLibrary creation failed: java.lang.IllegalArgumentException: Comparison method violates its general contract! at org.oxycblt.auxio.music.MusicRepositoryImpl$indexImpl$deviceLibraryJob$1.invokeSuspend(MusicRepository.kt:473) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32) at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

@OxygenCobalt
Copy link
Owner

Okay, that turned out not to be enough. I need to do another patch that provides finer detail stack traces, will try to do that later this evening @denny466.

@OxygenCobalt
Copy link
Owner

OxygenCobalt commented Jun 29, 2024

Can you guys get the stack trace from this build @denny466 @JRDetwiler?

Auxio_Canary.zip

@OxygenCobalt OxygenCobalt added bug Something isn't working music Related to music loading critical Need to get this fixed right now labels Jun 29, 2024
@denny466
Copy link

@OxygenCobalt

java.lang.Exception: DeviceLibrary creation failed: java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.util.TimSort.mergeHi(TimSort.java:903)
	at java.util.TimSort.mergeAt(TimSort.java:520)
	at java.util.TimSort.mergeCollapse(TimSort.java:448)
	at java.util.TimSort.sort(TimSort.java:245)
	at java.util.Arrays.sort(Arrays.java:1344)
	at java.util.ArrayList.sort(ArrayList.java:1738)
	at java.util.Collections.sort(Collections.java:210)
	at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(MutableCollectionsJVM.kt:42)
	at org.oxycblt.auxio.list.sort.Sort.songsInPlace(Sort.kt:105)
	at org.oxycblt.auxio.list.sort.Sort.songs(Sort.kt:51)
	at org.oxycblt.auxio.image.extractor.Cover$Companion.order(Cover.kt:51)
	at org.oxycblt.auxio.image.extractor.ParentCover$Companion.from(Cover.kt:64)
	at org.oxycblt.auxio.music.device.ArtistImpl.<init>(DeviceMusicImpl.kt:479)
	at org.oxycblt.auxio.music.device.DeviceLibraryFactoryImpl.create(DeviceLibrary.kt:261)
	at org.oxycblt.auxio.music.device.DeviceLibraryFactoryImpl$create$1.invokeSuspend(Unknown Source:18)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

	at org.oxycblt.auxio.music.MusicRepositoryImpl$indexImpl$deviceLibraryJob$1.invokeSuspend(MusicRepository.kt:476)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:32)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

@OxygenCobalt
Copy link
Owner

Cool @JRDetwiler @denny466, can you try this APK to see if it works?

Auxio_Canary.zip

More or less, I was abusing certain functionality to do sorting (in this case cover sorting) which crashed w/certain inputs. It's been in Auxio for several versions now, but since I sort album cover orderings during music loading now it was finally triggered on your end. I got rid of that stuff and it should work now, hopefully.

@denny466
Copy link

@OxygenCobalt It works. Thanks! 🫶
The first scan took 7 minutes and when I start the app after fully closing it, it loads 20 seconds. 3.4.3 is several times faster but I guess this is discardable since not everybody has a 5 figure library. Maybe caching would be a idea? I'll be back when something else comes up. Best regards!

@OxygenCobalt
Copy link
Owner

OxygenCobalt commented Jun 30, 2024

The first scan took 7 minutes and when I start the app after fully closing it, it loads 20 seconds. 3.4.3 is several times faster but I guess this is discardable since not everybody has a 5 figure library. Maybe caching would be a idea? I'll be back when something else comes up. Best regards!

It's a debug build, so it's going to be a lot slower. The 3.5.1 patch (and 3.5.0) are much faster.

Anyway, thanks, will close this now.

@denny466
Copy link

denny466 commented Jul 9, 2024

Hey @OxygenCobalt I'm afraid the issue came back to haunt me on 3.5.1

java.lang.Exception: DeviceLibrary creation failed: java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.util.TimSort.mergeHi(TimSort.java:903)
	at java.util.TimSort.mergeAt(TimSort.java:520)
	at java.util.TimSort.mergeForceCollapse(TimSort.java:461)
	at java.util.TimSort.sort(TimSort.java:254)
	at java.util.Arrays.sort(Arrays.java:1344)
	at java.util.ArrayList.sort(ArrayList.java:1738)
	at java.util.Collections.sort(Collections.java:210)
	at kotlin.collections.CollectionsKt__MutableCollectionsJVMKt.sortWith(Unknown Source:12)
	at org.oxycblt.auxio.list.sort.Sort$Mode$ByAlbum.sortSongs(SourceFile:76)
	at org.oxycblt.auxio.list.sort.Sort.songs(SourceFile:14)
	at org.oxycblt.auxio.image.extractor.Cover$Companion.order(SourceFile:8)
	at org.oxycblt.auxio.music.device.ArtistImpl.<init>(SourceFile:381)
	at okio.Path$Companion.create(SourceFile:13)
	at org.oxycblt.auxio.music.device.DeviceLibraryFactoryImpl$create$1.invokeSuspend(Unknown Source:16)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Unknown Source:6)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(SourceFile:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:31)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:94)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:92)

	at org.oxycblt.auxio.music.MusicRepositoryImpl$indexImpl$deviceLibraryJob$1.invokeSuspend(SourceFile:88)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Unknown Source:6)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(SourceFile:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:31)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:94)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:92)

@OxygenCobalt
Copy link
Owner

The fix apparently made the bug worse. I absolutely hate this OS.

Report the error from this @denny466 @JRDetwiler

Auxio_SortTrace.zip

@denny466
Copy link

Here you go @OxygenCobalt

java.lang.Exception: DeviceLibrary creation failed: java.lang.Exception: Album asc sort error: java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at org.oxycblt.auxio.list.sort.Sort$Mode$ByAlbum.sortSongs(SourceFile:148)
	at org.oxycblt.auxio.list.sort.Sort.songs(SourceFile:14)
	at org.oxycblt.auxio.image.extractor.Cover$Companion.order(SourceFile:8)
	at org.oxycblt.auxio.music.device.ArtistImpl.<init>(SourceFile:381)
	at okio.Path$Companion.create(SourceFile:13)
	at org.oxycblt.auxio.music.device.DeviceLibraryFactoryImpl$create$1.invokeSuspend(Unknown Source:16)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Unknown Source:6)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(SourceFile:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:31)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:94)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:92)

	at org.oxycblt.auxio.music.MusicRepositoryImpl$indexImpl$deviceLibraryJob$1.invokeSuspend(SourceFile:88)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:8)
	at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Unknown Source:6)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(SourceFile:23)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:31)
	at kotlinx.coroutines.DispatchedTask.run(Unknown Source:94)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:92)

@OxygenCobalt
Copy link
Owner

Alright, so it's an issue with name comparison. Can you see if disabling Settings -> Content -> Intelligent sorting does anything @denny466?

@denny466
Copy link

denny466 commented Jul 10, 2024

Disabling Intelligent sorting did the trick on both the APK you provided and F-droid release. Listening to music just fine now. Thanks @OxygenCobalt

@OxygenCobalt
Copy link
Owner

Can you try out this new APK really quick (clear storage so you were in the same situation when you reported the bug) @denny466

Auxio_Sort2.zip

@denny466
Copy link

This APK successfully loaded my library with intelligent sorting enabled! Nice going @OxygenCobalt

@OxygenCobalt
Copy link
Owner

Thanks pushed 3.5.2 @denny466

@JRDetwiler
Copy link
Author

So sorry I haven't been able to test until now, the latest fix works for me too. Thank you so much!

@OxygenCobalt OxygenCobalt unpinned this issue Jul 18, 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

3 participants