Open andrewshadura opened 4 years ago
This was already reported a while ago, and there is unfortunately no way to reproduce. It has nothing to do with PeerTube in particular, but just with lists. If there will be a way to reproduce this consistently this issue can be reopened, but as of now there is none. Thank you for the report anyway! ;-)
Well, it happens here all the time, each time, is there any way I can use this to help?
Ah. Then we probably need logs, don't we, @Stypox?
I don't think logs would help. I already tried fixing this bug but failed, since NewPipe is already doing what the error suggests to do:
Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
So it's an OS bug that NewPipe can't work around. Okay. Sorry, @andrewshadura.
Can’t we at least catch the exception in a better way?
The issue is, that exception does not come from NewPipe's code, but from some other library code. Therefore catching the error and ignoring it would probably not solve anything, because the app would be put in an unstable state where something is wrong and would crash again with another kind of crash.
I’ve just found an interesting fact. First of all, I’m using a remote to navigate the list. Second, it only happens when I navigate it in a particular way. The screen is a grid of 2½ rows by 5 columns. For some reason, only 12 thumbnails are displayed:
The crash usually happens when I press "down" while the last element is focused (but not every time, I haven’t found the exact 100% reproducible sequence).
I’m wondering, can the crash be somehow related with the fact fewer items have been preloaded than the grid expects? I don’t understand it from the code, how is the number of items to preload determined?
Thank you for the further information. This might be related to the issue about infinite loading in lists when the initial number of items is smaller than the screen size (I read about that issue earlier today, but now can't find it anymore. @opusforlife2 can you find it?)
how is the number of items to preload determined?
That's service-dependent, i.e. it depends on the implementation of the service in NewPipeExtractor.
@Stypox #1974.
Looks like I have the same issue scrolling down manualy created Bookmarked Playlist.
I was able to reproduce this twice. Steps:
Is there anything that can be done? Like for example handle this exception and throw another, adding more details in the error message that can be useful to identify what causes this error?
This crash does not happen very often, but it happens every now and then, always when scrolling to the top of some kind of list. I wasn't able to reliably reproduce it, but that doesn't mean there's no way to debug this.
Hello, I was able to reproduce the bug similarly to what said by @532910:
I was able to reproduce this twice. Steps:
1. Open a Bookmarked Playlist with a lot of videos i.e. scrollable 2. Tap one of the latest videos and watch it till the end (possibly in fullscreen mode). You cat FF of course. 3. Press back to return to the playlist. 4. Scroll to the top of the playlist.
My steps to reproduce:
Open a custom scrollable playlist
Open any video, provided that you leave items in the list to scroll up later
In any order:
Exit fullscreen;
Go back to the list without pausing or closing the video;
Scroll up;
It should crash.
Hope this can help.
@Ojd2000 thank you for providing some detailed instructions, though I can't reproduce even with those
I can reproduce this crash following way:
Hopefully this way crash is reproducible for you.
@hlintala I faced this crash too a few times recently, but I couldn't find a certain way to reproduce it and report. It seems that you did, I can confirm this way the crash should occur.
@tsiflimagas
I have also discovered that you can step away from crashing state by returning back to bookmarked playlist view.
By the way in a crashing state you can see name of the playlist at top left corner (sometimes hidden by icon of playlist item)
Closed #7486 and #7512 in favor of this. The manual from #7512 looks promising (even tough I didn't check it).
@litetex I could reproduce with @hlintala method, I tried to find the root source of this bug a month ago or so, but even then the crash is inside Androd libraries and that doesn't give useful information
@Stypox
We found the problem: https://github.com/TeamNewPipe/NewPipe/issues/3368#issuecomment-1013541937 🥳
I am not sure if this error I have just got is related but I am posting it here anyway.
This is the first crash I have experienced with this version of NewPipe, so I am reporting it
java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7297)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I always run the latest version, so I will see if it still happens after an upgrade.
By following steps mentioned above, I can consistently reproduce the crash on version 0.22.1:
java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7297)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7050)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Not sure if the above problem is just a random error, but the problem might be caused by the header: In #7659 I rewrote the header so that it's supplied dynamically: https://github.com/TeamNewPipe/NewPipe/pull/7659/files#diff-d075c1aaf95acf093a7feaa093198bfbc9c4d5b479e2b57effdaf7a9e74448d9R265
However since the header is only built once (e.g. https://github.com/TeamNewPipe/NewPipe/pull/7659/files#diff-7bdacd85bbbb0481247ad81e0e17840e930afaa9b7d3741e7d947d621e62f44dR69-R85) it can happen that the same object is supplied multiple times. This shouldn't happen because there can only be ONE header (not sure why it tries to attach the same header a second time).
I'm pretty sure that there is a race condition (maybe inside RecyclerView itself) or something similar. I think we can only fix this by reworking the Channel-/Playlist-/Related-ItemsFragment so that it can work with multiple headers which might cause other problems.
I think we should only invest time here if it occurs more often.
I face this issue multiple times a day by scrolling through local playlists. The descriptions above fits to the error behavior I witness. I am using the playlist feature extensively and the app crashes regularly when using local playlists on the home screen. Especially when opening and watching a video on the end of a playlist, closing the video, deleting it and scrolling up. (No accurate description, I know and I am sorry, but it seems to be a bit random) So
"...if it occurs more often."
seems to be a question on how one is using the app.
java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7297)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
@litetex ^
Reported in https://github.com/TeamNewPipe/NewPipe/issues/8164 with 0.22.1.
In #7659 I rewrote the header so that it's supplied dynamically
It seems the changes have been not made for local lists: in LocalItemListAdapter
, which is used by BaseLocalListFragment
(the base abstract class of LocalPlaylistFragmen
t (used for local playlists), StatisticsPlaylistFragment
(used for the history) and BookmarkFragment
(used for the Bookmarked Playlists
tab)), I can see the old code removed or the one before the changes of #7659 in this Adapter
.
@litetex Do you want to take care of this or should it be done by someone else?
Someone else can do it if he/she wants :)
I might also pick it up when nobody want's to fix it ;)
I believe I may be encountering the same bug. It usually happens when I scroll up, but not all the time.
java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7297)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
It just happened to me on 0.24.1
Happened to me as well
java.lang.IllegalStateException: ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7297)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6416)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
My way of recreating bug is more useful to debug the problem:
1: goto a playlist 2: delete an item 3: scroll to top of playlist (probably past the top?)
Checklist
Steps to reproduce the bug
Actual behaviour
Crash (see below).
Expected behavior
I’d expect more video thumbnails to appear.
Logs
Exception
Crash log
Device info