Iglistkit: Crash trying perform update data at end a request many times

Created on 28 Feb 2017  路  18Comments  路  Source: Instagram/IGListKit

New issue checklist

General information

  • IGListKit version: 2.1.0
  • iOS version(s): 10.2
  • CocoaPods/Carthage version: Cocoapods 1.2.0
  • Xcode version: 8.2.1
  • Devices/Simulators affected:
  • Reproducible in the demo project? (Yes/No): No
  • Related issues:

I have a section with an horizontal section and theri adapter inside the main, the horizontal section has N number of objects and execute a request call for another objects of the horizontall section, when the process end and try performupdate the horizontall section , have the following crash when try making scroll so fast and update the data at same time

On that moment when make scroll so fast and is executing request and calling the reload data the method crash and says:

"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to insert section 1 but there are only 1 sections after the update"

i have tried put the request in another thread with priority .userInitiated , thinking was isse of request, but notthing

here is a project test with the failure... if you scroll slowly, the working is normal, try making scroll so fast
Test IGListKit Failure.zip

question

All 18 comments

Thanks @kleiberjp !

Can you provide any more information here?

@jessesquires i have update the description of issue

It would be much easier to help / understand the problem if you could provide an example project 馃槄

Have you triple checked that the object diff identifiers are unique?

+1 an example project would be _really_ helpful understanding the problem here

@rnystrom @heumn @jessesquires hi guys sorry by the late.. i have updated the issue description with the project test.. hope you can helpe with a solution pls... and respect to the verify of diff identifiers @heumn , already check that diff identifiers were the correct and doesn麓t work.

@kleiberjp I'm having a little trouble getting this (really cool demo) to crash 馃槥

One thing though, you're using a lot of embedded adapters. We discovered a crash w/ using a bunch of them like this fixed in #517. You might want to update your Podfile to point to the master branch of IGListKit and see if that solves things for you.

@rnystrom oh, did you try to scroll very very fast? to getting this, to me happens when I scroll fast fast, quickly I stopped, did not let reload downloaded items, and scroll quickly back up. But i try to update podfile and validate that nothing wrong occurs on project with the update

I downloaded the project and after I pointed it to master I am unable to make this crash. It seems like you were running into #517 :)

This should fix it as @rnystrom pointed out

pod 'IGListKit', :git=> '[email protected]:Instagram/IGListKit.git', :branch => 'master' 

Sorry guys @rnystrom @heumn but i麓m experimenting the same issue 馃憥 馃槱 .. and i dont know if is in a bad handle of data or what .. try again making pod to the master branch, with the same project, this is the stack trace of the crash..

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to insert section 1 but there are only 1 sections after the update'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010586ad4b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001052cc21e objc_exception_throw + 48
    2   CoreFoundation                      0x000000010586ee42 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x0000000104e6166d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
    4   UIKit                               0x00000001065e4d71 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 7861
    5   UIKit                               0x00000001065efe72 -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
    6   UIKit                               0x00000001065f01b4 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 432
    7   UIKit                               0x00000001065effe1 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
    8   UIKit                               0x00000001065eff63 -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
    9   UIKit                               0x00000001065efeb8 -[UICollectionView performBatchUpdates:completion:] + 53
    10  IGListKit                           0x00000001047628fc -[IGListAdapterUpdater performBatchUpdatesWithCollectionView:] + 2972
    11  IGListKit                           0x00000001047654e7 __54-[IGListAdapterUpdater queueUpdateWithCollectionView:]_block_invoke + 359
    12  libdispatch.dylib                   0x0000000109bed978 _dispatch_call_block_and_release + 12
    13  libdispatch.dylib                   0x0000000109c170cd _dispatch_client_callout + 8
    14  libdispatch.dylib                   0x0000000109bf78a4 _dispatch_main_queue_callback_4CF + 406
    15  CoreFoundation                      0x000000010582ee49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    16  CoreFoundation                      0x00000001057f437d __CFRunLoopRun + 2205
    17  CoreFoundation                      0x00000001057f3884 CFRunLoopRunSpecific + 420
    18  GraphicsServices                    0x000000010b6eaa6f GSEventRunModal + 161
    19  UIKit                               0x0000000105c8ec68 UIApplicationMain + 159
    20  Test IGListKit Failure              0x000000010463415f main + 111
    21  libdyld.dylib                       0x0000000109c6368d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I let again the project with the changes

Test IGListKit Failure.zip

@kleiberjp can you provide some detailed steps to reproduce?

I couldn't get a crash w/ the stack trace that you pasted. I did get a crash where a UINib couldn't be found. It looks like you're passing nil to the bundle. That might need to be a specific bundle.

ok the steps are easy:
In the moment the app load give scroll fast super hiper mega fast, in forwards and backwards, there will be a moment in wich is processing many data for the scroll and demanding append data, the library crash.

And could you please indicateme in wich class - line code have to set a nib ???

I finally got it to crash again... Sorry for my misunderstanding :) To be able to help you debug I will see if I can figure out a way to get it to crash consistently. It is tiresome to sit here dragging down _insanely_ fast ;)

Btw I see tons of these:

The behavior of the UICollectionViewFlowLayout is not defined because:
2017-03-16 09:40:51.300 Test IGListKit Failure[7153:216217] the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.

Have you tried to fix this? UICollectionView has some weird cases and starting there seems like a good starting point :)

@kleiberjp scrolling fast vertically or horizontally?

About the nib, its in UtilsExtension.swift where you extend IGListCollectionContext and dequeue a cell with bundle: nil.

@rnystrom vertically the scroll, well i check the failure trying to dequeue cell, normally how i麓m instancing the cell with the class and not from the xib, consider not needed use a bundle.

@heumn i麓m gonna check what you recommend

Seems like this is resolved??

closing due to inactivity

Hi,
I am facing same problem when i have both horizontal and vertical scroll view. It
I followed the example tutorial but it did not help me much.

I get error message saying:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to insert section 0 but there are only 0 sections after the update'.

This happens when i scroll very fast. For both vertical and horizontal cell i have images and i am downloading those images.

@rnystrom @jessesquires , If this is fixed or you have solution, please help me.

@KumariOS can you open a new issue for this? Also when you hit the exception do po [IGListDebugger dump] from lldb. And if you can get a sample reproducing the issue that would be very helpful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rnystrom picture rnystrom  路  34Comments

RamblinWreck77 picture RamblinWreck77  路  17Comments

Megaman63 picture Megaman63  路  17Comments

ishabazz picture ishabazz  路  24Comments

jessesquires picture jessesquires  路  16Comments