Instabug-iOS icon indicating copy to clipboard operation
Instabug-iOS copied to clipboard

Crash at IBGChatCollectionView

Open AnderGoig opened this issue 1 year ago • 3 comments

Steps to Reproduce the Problem

Some of our users are reporting crashes in the app when Instabug chats are opened.

Expected Behavior

The app does not crash when existing chat is opened.

Actual Behavior

The app crashes when an existing chat is opened.

See Stacktrace
OS Version: iOS 18.1 (22B5054e)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0

Application Specific Information:
Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <IBGInboundVideoCell: 0x117625e00; baseClass = UICollectionViewCell; frame = (0 139.667; 402 154.74); layer = <CALayer: 0x3025c10e0>>; Collection view: <IBGChatCollectionView: 0x117345c00; baseClass = UICollectionView; frame = (0 0; 402 663.667); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x302ba72a0>; backgroundColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x302407620>; contentOffset: {0, 0}; contentSize: {402, 570.9609375}; adjustedContentInset: {0, 0, 0, 0}; layout: <IBGChatViewFlowLayout: 0x10dc9b480>; dataSource: <IBGChatPresenter: 0x302b29ec0>>

Thread 0 Crashed:
0   CoreFoundation                  0x318fb07cc         __exceptionPreprocess
1   libobjc.A.dylib                 0x31359f2e0         objc_exception_throw
2   Foundation                      0x316fb39a8         -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
3   UIKitCore                       0x31e8fde0c         __43-[UICollectionView _updateVisibleCellsNow:]_block_invoke.499
4   UIKitCore                       0x31f03d20c         -[_UICollectionViewSubviewManager removeAllDequeuedViewsWithEnumerator:]
5   UIKitCore                       0x31e0b5a44         -[UICollectionView _updateVisibleCellsNow:]
6   UIKitCore                       0x31e20ddd4         -[UICollectionView layoutSubviews]
7   UIKitCore                       0x31df157c0         -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8   QuartzCore                      0x31c51e0e0         CA::Layer::layout_if_needed
9   QuartzCore                      0x31c51dc6c         CA::Layer::layout_and_display_if_needed
10  QuartzCore                      0x31c574db4         CA::Context::commit_transaction
11  QuartzCore                      0x31c4f3bdc         CA::Transaction::commit
12  QuartzCore                      0x31c536ec4         CA::Transaction::flush_as_runloop_observer
13  UIKitCore                       0x31dfabb84         _UIApplicationFlushCATransaction
14  UIKitCore                       0x31dfa9180         __setupUpdateSequence_block_invoke_2
15  UIKitCore                       0x31dfa8ff4         _UIUpdateSequenceRun
16  UIKitCore                       0x31dfa8c44         schedulerStepScheduledMainSection
17  UIKitCore                       0x31dfa9bb8         runloopSourceCallback
18  CoreFoundation                  0x318f84324         __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
19  CoreFoundation                  0x318f842b8         __CFRunLoopDoSource0
20  CoreFoundation                  0x318f81dbc         __CFRunLoopDoSources0
21  CoreFoundation                  0x318f80fb8         __CFRunLoopRun
22  CoreFoundation                  0x318f8082c         CFRunLoopRunSpecific
23  GraphicsServices                0x3b16011c0         GSEventRunModal
24  UIKitCore                       0x31e2db9a0         -[UIApplication _run]
25  UIKitCore                       0x31e38a164         UIApplicationMain
26  Meld                            0x20016a8ec         main (AppDelegate.swift:34)
27  <unknown>                       0x1bbed9ec8         <redacted>

Thread 0 Crashed:
0   CoreFoundation                  0x318fb07cc         __exceptionPreprocess
1   libobjc.A.dylib                 0x31359f2e0         objc_exception_throw
2   Foundation                      0x316fb39a8         -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
3   UIKitCore                       0x31e8fde0c         __43-[UICollectionView _updateVisibleCellsNow:]_block_invoke.499
4   UIKitCore                       0x31f03d20c         -[_UICollectionViewSubviewManager removeAllDequeuedViewsWithEnumerator:]
5   UIKitCore                       0x31e0b5a44         -[UICollectionView _updateVisibleCellsNow:]
6   UIKitCore                       0x31e20ddd4         -[UICollectionView layoutSubviews]
7   UIKitCore                       0x31df157c0         -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
8   QuartzCore                      0x31c51e0e0         CA::Layer::layout_if_needed
9   QuartzCore                      0x31c51dc6c         CA::Layer::layout_and_display_if_needed
10  QuartzCore                      0x31c574db4         CA::Context::commit_transaction
11  QuartzCore                      0x31c4f3bdc         CA::Transaction::commit
12  QuartzCore                      0x31c536ec4         CA::Transaction::flush_as_runloop_observer
13  UIKitCore                       0x31dfabb84         _UIApplicationFlushCATransaction
14  UIKitCore                       0x31dfa9180         __setupUpdateSequence_block_invoke_2
15  UIKitCore                       0x31dfa8ff4         _UIUpdateSequenceRun
16  UIKitCore                       0x31dfa8c44         schedulerStepScheduledMainSection
17  UIKitCore                       0x31dfa9bb8         runloopSourceCallback
18  CoreFoundation                  0x318f84324         __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
19  CoreFoundation                  0x318f842b8         __CFRunLoopDoSource0
20  CoreFoundation                  0x318f81dbc         __CFRunLoopDoSources0
21  CoreFoundation                  0x318f80fb8         __CFRunLoopRun
22  CoreFoundation                  0x318f8082c         CFRunLoopRunSpecific
23  GraphicsServices                0x3b16011c0         GSEventRunModal
24  UIKitCore                       0x31e2db9a0         -[UIApplication _run]
25  UIKitCore                       0x31e38a164         UIApplicationMain
26  Meld                            0x20016a8ec         main (AppDelegate.swift:34)
27  <unknown>                       0x1bbed9ec8         <redacted>

Thread 1
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 2
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 3 name: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib          0x3b9d6b688         mach_msg2_trap
1   libsystem_kernel.dylib          0x3b9d6ed94         mach_msg2_internal
2   libsystem_kernel.dylib          0x3b9d6ecac         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3b9d6eaf8         mach_msg
4   CoreFoundation                  0x318f81a80         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x318f8112c         __CFRunLoopRun
6   CoreFoundation                  0x318f8082c         CFRunLoopRunSpecific
7   Foundation                      0x31684897c         -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
8   Foundation                      0x3168487cc         -[NSRunLoop(NSRunLoop) runUntilDate:]
9   UIKitCore                       0x31e2eedf8         -[UIEventFetcher threadMain]
10  Foundation                      0x316859ad4         __NSThread__start__
11  libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 4
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 5
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 6
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 7
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 8
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 9
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 10
0   libsystem_kernel.dylib          0x3b9d711b0         __semwait_signal
1   libsystem_c.dylib               0x328a5da74         nanosleep
2   libsystem_c.dylib               0x328abb54c         sleep
3   Meld                            0x200e3b8d4         monitorCachedData
4   libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 11 name: SentryCrash Exception Handler (Secondary)
0   libsystem_kernel.dylib          0x3b9d6b688         mach_msg2_trap
1   libsystem_kernel.dylib          0x3b9d6ed94         mach_msg2_internal
2   libsystem_kernel.dylib          0x3b9d6cbf8         thread_suspend
3   Meld                            0x200e21d10         handleExceptions
4   libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 12 name: SentryCrash Exception Handler (Primary)
0   libsystem_kernel.dylib          0x3b9d6b688         mach_msg2_trap
1   libsystem_kernel.dylib          0x3b9d6ed94         mach_msg2_internal
2   libsystem_kernel.dylib          0x3b9d6ecac         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3b9d6eaf8         mach_msg
4   Meld                            0x200e21d3c         handleExceptions
5   libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 13 name: io.sentry.app-hang-tracker
0   libsystem_kernel.dylib          0x3b9d711b0         __semwait_signal
1   libsystem_c.dylib               0x328a5da74         nanosleep
2   Foundation                      0x3169610a4         +[NSThread sleepForTimeInterval:]
3   Meld                            0x200e02704         -[SentryANRTracker detectANRs]
4   Foundation                      0x316859ad4         __NSThread__start__
5   libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 14 name: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x3b9d6b688         mach_msg2_trap
1   libsystem_kernel.dylib          0x3b9d6ed94         mach_msg2_internal
2   libsystem_kernel.dylib          0x3b9d6ecac         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3b9d6eaf8         mach_msg
4   CoreFoundation                  0x318f81a80         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x318f8112c         __CFRunLoopRun
6   CoreFoundation                  0x318f8082c         CFRunLoopRunSpecific
7   CFNetwork                       0x31b9dbedc         +[__CFN_CoreSchedulingSetRunnable _run:]
8   Foundation                      0x316859ad4         __NSThread__start__
9   libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 15
0   libsystem_kernel.dylib          0x3b9d6b688         mach_msg2_trap
1   libsystem_kernel.dylib          0x3b9d6ed94         mach_msg2_internal
2   libsystem_kernel.dylib          0x3b9d6ecac         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3b9d6eaf8         mach_msg
4   CoreFoundation                  0x318f81a80         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x318f8112c         __CFRunLoopRun
6   CoreFoundation                  0x318f8082c         CFRunLoopRunSpecific
7   Foundation                      0x31684897c         -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
8   Foundation                      0x316848850         -[NSRunLoop(NSRunLoop) run]
9   SwiftUI                         0x322591c54         DisplayLink.asyncThread
10  SwiftUI                         0x322590fb8         DisplayLink.asyncThread
11  Foundation                      0x316859ad4         __NSThread__start__
12  libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 16
0   libsystem_kernel.dylib          0x3b9d6b688         mach_msg2_trap
1   libsystem_kernel.dylib          0x3b9d6ed94         mach_msg2_internal
2   libsystem_kernel.dylib          0x3b9d6ecac         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3b9d6eaf8         mach_msg
4   CoreFoundation                  0x318f81a80         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x318f8112c         __CFRunLoopRun
6   CoreFoundation                  0x318f8082c         CFRunLoopRunSpecific
7   CoreFoundation                  0x318febce8         CFRunLoopRun
8   CoreMotion                      0x3338ac0dc         <redacted>
9   libsystem_pthread.dylib         0x429ae4378         _pthread_start

Thread 17
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 18
0   libsystem_kernel.dylib          0x3b9d6b410         __workq_kernreturn
1   libsystem_pthread.dylib         0x429ae2cc4         _pthread_wqthread

Thread 19
0   libsystem_kernel.dylib          0x3b9d6b61c         semaphore_timedwait_trap
1   libdispatch.dylib               0x3289be6e4         _dispatch_sema4_timedwait
2   libdispatch.dylib               0x3289bece4         _dispatch_semaphore_wait_slow
3   libdispatch.dylib               0x3289cfb5c         _dispatch_worker_thread
4   libsystem_pthread.dylib         0x429ae4378         _pthread_start





EOF

Instabug integration code

CrashReporting.enabled = false
        
Instabug.start(withToken: Constants.Instabug.token, invocationEvents: .none)
Instabug.coreDataInstrumentationEnabled = false
Instabug.welcomeMessageMode = .disabled
Instabug.setColorTheme(.light)
Instabug.setLocale(.english)
Instabug.setValue(StringKey.askQuestion.localized(), forStringWithKey: kIBGAskAQuestionStringName)
        
let theme = Theme()
theme.primaryColor = UIColor(.Factory.Main.red)
Instabug.theme = theme
        
BugReporting.promptOptionsEnabledReportTypes = [.bug, .feedback]
Replies.inAppNotificationsEnabled = false
        
APM.uiHangsEnabled = false
APM.screenLoadingEnabled = false
APM.coldAppLaunchEnabled = false
APM.hotAppLaunchEnabled = false
APM.enabled = false
NetworkLogger.enabled = false

SDK Version

13.4.2

iOS Version

iOS 18.0

Device Model

iPhone 14 Pro, iPhone 16, iPad (8th gen), iPhone 14

AnderGoig avatar Oct 02 '24 14:10 AnderGoig

This issue has been automatically marked as stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 12 '24 02:10 stale[bot]

I'm getting similar crash reports:

Fatal Exception: NSInternalInconsistencyException Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <IBGInboundImageCell: 0x10ddef600; baseClass = UICollectionViewCell; frame = (0 317; 393 155.934); layer = <CALayer: 0x3031f40c0>>; Collection view: <IBGChatCollectionView: 0x11e954000; baseClass = UICollectionView; frame = (0 0; 393 643); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x303eddd70>; backgroundColor = UIExtendedSRGBColorSpace 0.2 0.2 0.2 1; layer = <CALayer: 0x3031c3220>; contentOffset: {0, 0}; contentSize: {393, 472.8671875}; adjustedContentInset: {0, 0, 0, 0}; layout: <IBGChatViewFlowLayout: 0x11e88b700>; dataSource: <IBGChatPresenter: 0x303edca20>>

algrid avatar Oct 22 '24 07:10 algrid

Is there an ETA for the fix to be released? It makes us unable to communicate with users.

algrid avatar Oct 23 '24 12:10 algrid

@AhmedAshraf605 was this issue fixed in 13.4.3?

AnderGoig avatar Oct 30 '24 16:10 AnderGoig

I tried 13.4.3 yesterday and for me the problem is still there 😔

algrid avatar Oct 30 '24 16:10 algrid

@algrid I was given a custom branch in which they say they fixed this crash. I thought they would have merged it in this release, but apparently not. If you're using SPM, maybe you can give it a try: release/fix-IBGChatPresenter-collectionView-crash-SPM/13.4.2

AnderGoig avatar Oct 30 '24 16:10 AnderGoig

@AnderGoig thank you! I'm not using SPM now, but if I have no choice I may try to add it alongside cocoapods, in theory it should work.

algrid avatar Oct 30 '24 18:10 algrid

@algrid they also gave me the corresponding for CocoaPods (not sure if it still works though)

pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/fix-IBGChatPresenter-collectionView-crash/13.4.2/Instabug.podspec'

AnderGoig avatar Oct 30 '24 18:10 AnderGoig

Hi @algrid @AnderGoig the fix will be out in the next release, thanks for your contribution

AhmedAshraf605 avatar Oct 31 '24 07:10 AhmedAshraf605

@AnderGoig thank you, it worked!

@AhmedAshraf605 thank you, hope it won't take too long!

algrid avatar Oct 31 '24 09:10 algrid

Hello @AnderGoig @algrid This is fixed in the latest release v14.0.0.

AhmedOS avatar Nov 10 '24 11:11 AhmedOS