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

3.1.1 IndexOutOfBoundsException: Inconsistency detected. #602

Closed
smelfungus opened this issue Jan 13, 2018 · 9 comments
Closed

3.1.1 IndexOutOfBoundsException: Inconsistency detected. #602

smelfungus opened this issue Jan 13, 2018 · 9 comments
Assignees
Labels

Comments

@smelfungus
Copy link

About this issue

Hi there! Getting instant crash since 3.1.1 update:
Working good for 3.0.5.
That's not obvious enough stacktrace as far as I can see, please notify if any additional information I can get should be acquired.
Thank you!

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{7f74c3b position=6 id=-1, oldPos=2, pLpos:2 scrap [attachedScrap] tmpDetached no parent} android.support.v7.widget.RecyclerView{359e79c VFED.VC.. ......ID 0,808-1120,2199 #7f080168 app:id/material_drawer_recycler_view}, adapter:com.mikepenz.fastadapter.FastAdapter@8155a5, layout:android.support.v7.widget.LinearLayoutManager@1c7ed7a, context:com@7f6b3a9
   at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5447)
   at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5629)
   at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
   at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
   at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
   at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
   at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
   at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
   at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3670)
   at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3434)
   at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1196)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
   at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
   at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
   at com.android.internal.policy.DecorView.onLayout(DecorView.java:761)
   at android.view.View.layout(View.java:19659)
   at android.view.ViewGroup.layout(ViewGroup.java:6075)
   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
   at android.view.Choreographer.doCallbacks(Choreographer.java:723)
   at android.view.Choreographer.doFrame(Choreographer.java:658)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
   at android.os.Handler.handleCallback(Handler.java:790)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:164)
   at android.app.ActivityThread.main(ActivityThread.java:6494)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Details

  • [3.1.1] Used library version
  • [27.0.2] Used support library version
  • [3.1.0-alpha08] Used gradle build tools version
  • [3.1 Canary 8] Used tooling / Android Studio version
@mikepenz
Copy link
Owner

@DummyCo thank you very much. I assume the IItemList introduced some regression somewhere. The stacktrace is sadly not really helpful. Sample code is a in such a case much more helpful.

Can you possibly describe a bit more what are you doing?

DiffUtil?
How do you set the items to the list?
When does the crash happen?
Which methods are you calling before that?

@mikepenz
Copy link
Owner

(can you please try if it happens with v3.1.0 ?)

@FelixMittermeier
Copy link

Interesting I'm not the only one getting this error 😄

@mikepenz
Copy link
Owner

mikepenz commented Jan 14, 2018 via email

@FelixMittermeier
Copy link

When using v3.1.0 it's crashing too:

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 16(offset:17).state:17 android.support.v7.widget.RecyclerView{15d62da VFED.VC.. ......ID 0,0-608,1280 #7f080168 app:id/material_drawer_recycler_view}, adapter:com.mikepenz.fastadapter.FastAdapter@77db30b, layout:android.support.v7.widget.LinearLayoutManager@294c5e8, context:de.mittermeier.felix.storyban.MainActivity@9078bc1 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5628) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2229) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1556) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1516) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:608) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3644) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3408) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1196) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:731) at android.view.View.layout(View.java:17661) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2346) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2068) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6344) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:621) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6236) 01-14 21:32:02.278 25483-25483/de.mittermeier.felix.storyban E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)

@mikepenz
Copy link
Owner

Ok thanks. Good to know :) It eliminates at least one position to look :D

I'll debug and test this tomorrow.

And I might (not promising anything) improve the selection stuff for sub items. let's see how it goes

@smelfungus
Copy link
Author

@mikepenz thank you for feedback!
Basically I'm having a bit complex feed powered with FastAdapter having something about 6 item types with stable ids, some of that items bound to the same type are paginated and populated to the feed via FastAdapterDiffUtil in random sequence according to server responses sequences what makes it a bit complicated to debug but I'll try to log all the populations leading to crash and create a simplified sample now.

@mikepenz
Copy link
Owner

mikepenz commented Jan 14, 2018 via email

@smelfungus
Copy link
Author

smelfungus commented Jan 14, 2018

So here is the sequence.
I'm trying to recreate the same set of data with lightweight layouts and sequential populating via Handlers or step-by-step with no space for any related code to execute on looper but it's firing just ok.
As far as I can imagine it's related to high main thread load and all these coincidences with internal RecyclerView events batching & pending processing etc.
I've also attached OnBindViewHolderListener and left timing in logs.
Last onBindViewHolder event before crash looks suspicious.

01-15 00:49:41.088 13845-13845: Second adapter batch item type: 2131230883 id: 442
01-15 00:49:41.088 13845-13845: Second adapter batch item type: 2131230881 id: 426
01-15 00:49:41.089 13845-13845: Second adapter batch item type: 2131230883 id: 424
01-15 00:49:41.090 13845-13845: Second adapter batch item type: 2131230880 id: 422
01-15 00:49:41.091 13845-13845: Second adapter batch item type: 2131230883 id: 420
01-15 00:49:41.091 13845-13845: Second adapter batch item type: 2131230883 id: 414
01-15 00:49:41.092 13845-13845: Second adapter batch item type: 2131230881 id: 412
01-15 00:49:41.093 13845-13845: Second adapter batch item type: 2131230883 id: 410
01-15 00:49:41.094 13845-13845: Second adapter batch item type: 2131230883 id: 408
                                Second adapter batch item type: 2131230882 id: 406
01-15 00:49:41.095 13845-13845: Second adapter batch item type: 2131230907 id: 15
01-15 00:49:41.096 13845-13845: Second adapter batch item type: 2131230907 id: 5
01-15 00:49:41.096 13845-13845: Second adapter batch item type: 2131230907 id: 7
01-15 00:49:41.099 13845-13845: Second adapter FastAdapterDiffUtil fired
01-15 00:49:41.100 13845-13845: First adapter FastAdapterDiffUtil fired
01-15 00:49:41.129 13845-13845: Second adapter batch item type: 2131230883 id: 442
01-15 00:49:41.130 13845-13845: Second adapter batch item type: 2131230881 id: 426
                                Second adapter batch item type: 2131230883 id: 424
01-15 00:49:41.131 13845-13845: Second adapter batch item type: 2131230880 id: 422
01-15 00:49:41.132 13845-13845: Second adapter batch item type: 2131230883 id: 420
                                Second adapter batch item type: 2131230883 id: 414
01-15 00:49:41.133 13845-13845: Second adapter batch item type: 2131230881 id: 412
                                Second adapter batch item type: 2131230883 id: 410
01-15 00:49:41.134 13845-13845: Second adapter batch item type: 2131230883 id: 408
                                Second adapter batch item type: 2131230882 id: 406
01-15 00:49:41.135 13845-13845: Second adapter batch item type: 2131230907 id: 15
                                Second adapter batch item type: 2131230907 id: 5
01-15 00:49:41.136 13845-13845: Second adapter batch item type: 2131230907 id: 7
01-15 00:49:41.138 13845-13845: Second adapter FastAdapterDiffUtil fired
01-15 00:49:41.158 13845-13845: Second adapter batch item type: 2131230883 id: 442
01-15 00:49:41.159 13845-13845: Second adapter batch item type: 2131230881 id: 426
                                Second adapter batch item type: 2131230883 id: 424
01-15 00:49:41.160 13845-13845: Second adapter batch item type: 2131230880 id: 422
                                Second adapter batch item type: 2131230883 id: 420
01-15 00:49:41.161 13845-13845: Second adapter batch item type: 2131230883 id: 414
01-15 00:49:41.162 13845-13845: Second adapter batch item type: 2131230881 id: 412
                                Second adapter batch item type: 2131230883 id: 410
                                Second adapter batch item type: 2131230883 id: 408
01-15 00:49:41.163 13845-13845: Second adapter batch item type: 2131230882 id: 406
01-15 00:49:41.164 13845-13845: Second adapter batch item type: 2131230907 id: 15
                                Second adapter batch item type: 2131230907 id: 5
01-15 00:49:41.165 13845-13845: Second adapter batch item type: 2131230907 id: 7
01-15 00:49:41.167 13845-13845: Second adapter FastAdapterDiffUtil fired
01-15 00:49:41.732 13845-13845: onBindViewHolder() called with: viewHolder = [ViewHolder{2921d41 position=0 id=442, oldPos=-1, pLpos:-1 no parent}], position = [0], payloads = [[]]
01-15 00:49:41.840 13845-13845: onBindViewHolder() called with: viewHolder = [ViewHolder{c456ea5 position=1 id=426, oldPos=-1, pLpos:-1 no parent}], position = [1], payloads = [[]]
01-15 00:49:42.345 13845-13845: First adapter FastAdapterDiffUtil fired
01-15 00:49:42.369 13845-13845: Second adapter batch item type: 2131230883 id: 442
01-15 00:49:42.370 13845-13845: Second adapter batch item type: 2131230881 id: 426
                                Second adapter batch item type: 2131230883 id: 424
01-15 00:49:42.371 13845-13845: Second adapter batch item type: 2131230880 id: 422
                                Second adapter batch item type: 2131230883 id: 420
                                Second adapter batch item type: 2131230883 id: 414
01-15 00:49:42.373 13845-13845: Second adapter batch item type: 2131230881 id: 412
                                Second adapter batch item type: 2131230883 id: 410
01-15 00:49:42.374 13845-13845: Second adapter batch item type: 2131230883 id: 408
                                Second adapter batch item type: 2131230882 id: 406
                                Second adapter batch item type: 2131230907 id: 15
01-15 00:49:42.375 13845-13845: Second adapter batch item type: 2131230907 id: 5
                                Second adapter batch item type: 2131230907 id: 7
01-15 00:49:42.377 13845-13845: Second adapter FastAdapterDiffUtil fired
01-15 00:49:42.440 13845-13845: Second adapter batch item type: 2131230883 id: 442
                                Second adapter batch item type: 2131230881 id: 426
                                Second adapter batch item type: 2131230883 id: 424
01-15 00:49:42.441 13845-13845: Second adapter batch item type: 2131230880 id: 422
                                Second adapter batch item type: 2131230883 id: 420
01-15 00:49:42.442 13845-13845: Second adapter batch item type: 2131230883 id: 414
                                Second adapter batch item type: 2131230881 id: 412
01-15 00:49:42.443 13845-13845: Second adapter batch item type: 2131230883 id: 410
                                Second adapter batch item type: 2131230883 id: 408
01-15 00:49:42.444 13845-13845: Second adapter batch item type: 2131230882 id: 406
                                Second adapter batch item type: 2131230907 id: 15
01-15 00:49:42.445 13845-13845: Second adapter batch item type: 2131230907 id: 5
                                Second adapter batch item type: 2131230907 id: 7
01-15 00:49:42.447 13845-13845: Second adapter FastAdapterDiffUtil fired
01-15 00:49:42.586 13845-13845: onBindViewHolder() called with: viewHolder = [ViewHolder{d6359a0 position=2 id=424, oldPos=-1, pLpos:-1 no parent}], position = [2], payloads = [[]]
01-15 00:49:42.636 13845-13845: onBindViewHolder() called with: viewHolder = [ViewHolder{2921d41 position=0 id=442, oldPos=-1, pLpos:-1 scrap [attachedScrap] tmpDetached no parent}], position = [0], payloads = [[]]

Added "FastAdapterDiffUtil fired" logs on last edit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants