XilinJia / Podcini

Open source podcast instrument for Android in Kotlin with media3, supporting channels, playlists, podcasts and single media from YouTube and YT Music as well as normal podcasts.
GNU General Public License v3.0
158 stars 7 forks source link

App prone to crashing when download is in progress #76

Closed summersab closed 1 month ago

summersab commented 2 months ago

Checklist

App version

6.1.6

Where did you get the app from

F-Droid

Android version

14 (LOS 21)

Device model

OnePlus 7 Pro

First occurred

No response

Steps to reproduce

Podcini is a little unstable when there is an active download in progress. It appears to have gotten better in recent versions, but it is still an issue. Sending the app to the background and bringing it to the foreground tends to cause a crash (it may take a few attempts). I believe there are other ways to trigger a crash while a download is in progress, but this seems to be the most reproducible method:

  1. Initiate a download and perform the following steps while the download is in progress
  2. Send the app to the background (press home, switch to another app, etc)
  3. Open Podcini or switch back to the app using the recent app switcher
  4. If the app doesn't crash, perform steps 2 and 3 a few times

Expected behaviour

This should cause the app to crash.

Current behaviour

App shouldn't crash.

Logs

No response

XilinJia commented 2 months ago

Reproduced this. It happens when Podcini is brought back to the foreground (during the downloads). Got the following exception:

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionEpisodeViewHolder{6182c9e position=0 id=172210508604100, oldPos=0, pLpos:-1 scrap [attachedScrap] tmpDetached no parent} ac.mdiq.podcini.ui.view.EpisodesRecyclerView{4548c14 VFED..... .......D 0,0-1080,1211 #7f0a02f7 app:id/recyclerView}, adapter:ac.mdiq.podcini.ui.fragment.FeedEpisodesFragment$FeedEpisodesAdapter@c9c98d0, layout:androidx.recyclerview.widget.LinearLayoutManager@625ecbd, context:androidx.appcompat.view.ContextThemeWrapper@fd2bfc
                                                                                                        at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:6590)
                                                                                                        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6796)
                                                                                                        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6757)
                                                                                                        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6753)

Appears the RecyclerView is not happy somehow.

XilinJia commented 2 months ago

Despite of the crash, the downloaded files appear to arrive unharmed

XilinJia commented 2 months ago

Likely fixed in 6.2.0

summersab commented 2 months ago

Yup, downloads still worked despite the occasional crashes.

I'll mark this as closed for now and will reopen if I see other related crashes.

XilinJia commented 2 months ago

downloads still worked despite the occasional crashes.

Do you still see occasional crashes in this case?

summersab commented 2 months ago

I just installed 6.2.0, so I haven't tested it extensively. I closed this because I take your word that you fixed it. If I see it happen again and can reproduce the problem, I'll reopen this issue, but in the meantime, I figured I'd reduce the clutter of open issues in front of you.

summersab commented 2 months ago

Reopening this. I'm getting ready for a road trip with my family and am downloading podcasts to listen to on the way. Starting multiple downloads (say, 5 or more) causes a lot of instability and crashes.

I don't know of it matters, but I am on the Queue view watching the episodes download, and that is when the crash happens. It may happen on any page, but I am not certain. I think it happens once one download finishes and the next begins.

XilinJia commented 2 months ago

OK, sorry about that. Fixed in the coming release. Same issue as I fixed in FeedEpisodes view. Other views don't appear to have this issue.

XilinJia commented 2 months ago

6.2.1 released

XilinJia commented 1 month ago

Seems this is not happening?

XilinJia commented 1 month ago

Seems not happening now.