TonicArtos / SuperSLiM

A layout manager for the RecyclerView with interchangeable linear, grid, and staggered displays of views, all with configurable section headers including the sticky variety as specified in the material design docs.
http://tonicartos.nz
2.12k stars 297 forks source link

Crashing at the end of list #142

Closed u2u4u closed 7 years ago

u2u4u commented 8 years ago

hi and thanks for your good library. I have a long recycle view that contain header simple text view and footers of it. however at the first it has no problem and works. but when i become to near the end of list it crashes with below message: 09-29 22:34:35.783 6065-6065/com.neganet.tst_superslim E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.neganet.tst_superslim, PID: 6065 java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. isScrap:false isAttached:true at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:4243) at android.support.v7.widget.RecyclerView$Recycler.recycleView(RecyclerView.java:4193) at com.tonicartos.superslim.LayoutState.recycleCache(LayoutState.java:56) at com.tonicartos.superslim.LayoutManager.scrollVerticallyBy(LayoutManager.java:379) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3458) at android.view.Choreographer$CallbackRecord.run(Choreographer.java) at android.view.Choreographer.doCallbacks(Choreographer.java) at android.view.Choreographer.doFrame(Choreographer.java) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java) at android.os.Handler.handleCallback(Handler.java) at android.os.Handler.dispatchMessage(Handler.java) at android.os.Looper.loop(Looper.java) at android.app.ActivityThread.main(ActivityThread.java) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) and at some shorter lists, at the end of list it stops and when try to scroll to up of the list it crashes with below message: 09-29 22:51:52.861 20513-20513/? E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.neganet.tst_superslim, PID: 20513 java.lang.StackOverflowError: stack size 8MB at android.support.v7.widget.ChildHelper.getOffset(ChildHelper.java:93) at android.support.v7.widget.ChildHelper.getChildAt(ChildHelper.java:156) at android.support.v7.widget.RecyclerView$LayoutManager.getChildAt(RecyclerView.java:6023) at com.tonicartos.superslim.LayoutManager.getAnchorAtStart(LayoutManager.java:1057) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:772) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) at com.tonicartos.s 09-29 22:51:52.868 20513-20533/? I/art﹕ Background sticky concurrent mark sweep GC freed 40034(4MB) AllocSpace objects, 0(0B) LOS objects, 0% free, 73MB/73MB, paused 36.328ms total 66.022ms 09-29 22:51:53.353 20513-20528/? W/art﹕ Suspending all threads took: 12.977ms 09-29 22:51:53.360 20513-20513/? E/JavaBinder﹕ !!! FAILED BINDER TRANSACTION !!! 09-29 22:51:53.361 20513-20513/? E/AndroidRuntime﹕ Error reporting crash android.os.TransactionTooLargeException at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java) at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java) at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690) 09-29 22:51:53.361 20513-20513/? I/Process﹕ Sending signal. PID: 20513 SIG: 9 what is the reason of that issue? how can i Fix it

Lingviston commented 8 years ago

Looks like I encounter same problem sometimes.

messer00 commented 8 years ago

That happens to me too.

2015-09-30 11:51 GMT+01:00 Vladislav notifications@github.com:

Looks like I encounter same problem sometimes.

— Reply to this email directly or view it on GitHub https://github.com/TonicArtos/SuperSLiM/issues/142#issuecomment-144358122 .

bschnack commented 8 years ago

Happens to me too. Seems to be when I am adding items to the end of the adapter post initialization and it tries to load the new data items into view.

frankjunqi commented 8 years ago

need to fix

IsaacSee commented 8 years ago

Hello, we are having the same issue, but it does not happend for every data sets we use in the app. Did you guys found a workaround or a configuration that might trigger this crash ?

robvree commented 8 years ago

Running into this as well. Each time I add new items to the adapter.

frankjunqi commented 8 years ago

If your item's view is complex , you will find the problem. Maybe you can try.

u2u4u commented 8 years ago

yes. my items are complex :)

Stay commented 8 years ago

Does anyone fix this bug? even on simple header list, it also trigger the OOM by scrolling around several times

vinitthaker commented 8 years ago

I am also facing the same issue. Have already wasted a lot of time in this. Need to find a different way to implement HeaderGridView now.

vvictor10 commented 8 years ago

First of all, thanks for the library, its pretty handy.

I am running into this same issue as well. If you guys look at the stack, line 825 is hit several times and it matches a recursion in the code. I am not sure if this is a bug or if there is any other alternative to this issue.

With the data we have, we run into this with a ~30 item list and scrolling all the way down to the last item is fine, but when coming back up, it chokes through the middle.

@TonicArtos Any clues or fixes for this issue?

12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: java.lang.StackOverflowError: stack size 8MB 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at android.support.v7.widget.ChildHelper.getOffset(ChildHelper.java:93) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at android.support.v7.widget.ChildHelper.getChildAt(ChildHelper.java:156) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at android.support.v7.widget.RecyclerView$LayoutManager.getChildAt(RecyclerView.java:6379) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.findAttachedHeaderOrFirstViewForSection(LayoutManager.java:992) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.getHeaderOrFirstViewForSection(LayoutManager.java:1239) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:793) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825) 12-08 08:39:39.151 1897-1897/com.abc.app_name.debug E/AndroidRuntime: at com.tonicartos.superslim.LayoutManager.fillNextSectionToStart(LayoutManager.java:825)

TonicArtos commented 8 years ago

Hi, I am working on the problem, but I won't be able to publish an update until I get a fixed connection again. My ISP keeps pushing back the date.

xu6148152 commented 8 years ago

It happened to me so...

atoropov commented 8 years ago

TonicArtos, excuse me, do you have any news on fixing this? We faced that issue and it seems to be a blocker for us.

TonicArtos commented 8 years ago

There has been significant work done on a new version which, amongst other things, fixes this problem. However, it is still not fully functional.

I recommend taking a look at it. The new version is available on the branch version5. I am working on it as and when I have time. I plan to have milestone 2 completed in a week or two.

I am not fixing bugs on the older version. There is a very good reason for this, the old design is flawed and unfixably bugged for many things without a rewrite. Version5 is a ground up rewrite of the library avoiding the mistakes of the previous design.

frankjunqi commented 8 years ago

@TonicArtos thank you ,so cool.

ogungulec commented 8 years ago

Hi all, This issue is happened to me as well. I think i have found the cause of the problem. It happens when you set wrong first positions on layout params of the items in recyclerview. Here is the example:

I had 9 items on my adapter. 0 , 3 and 5 were the postions for my headers. I accidently set all items first position as 5 (params.setFirstPosition(5)). Then i got this stackoverflowerror.

When i set the first positions correctly, problem is resolved:

    if (position == 1 || position == 3) {
        params.setFirstPosition(position - 1);
    } else if (position == 0 || position == 2 || position == 4) { // header positions
        params.setFirstPosition(position);
    } else {
        params.setFirstPosition(4);
    }
NaikSoftware commented 8 years ago

Have same issue..

AlvaroProjectPeople commented 8 years ago

I had the same issue and how ogungulec has said, the problem was in the headers index

pip1998 commented 8 years ago

Have same issue..

caltseng commented 8 years ago

+1 Seems like an edge case because we've only hit this once.

andyhaha commented 8 years ago

I also encounter the same problem. My item view is Complex,and It happened frequently! How to fix this bug, I am very anxious to find a solution! Can any one help me???

CharlyLafon37 commented 3 years ago

Wow. Closing the issue and marking it as invalid whereas you didn't release any fix. Nice move @TonicArtos