GetStream / stream-chat-swift

💬 iOS Chat SDK in Swift - Build your own app chat experience for iOS using the official Stream Chat API
https://getstream.io/chat/sdk/ios/
Other
860 stars 211 forks source link

-[_NSCoreDataTaggedObjectID id]: unrecognized selector sent to instance 0x936b6fc2c474fbe1 #3488

Open dfed opened 2 days ago

dfed commented 2 days ago

What did you do?

Show stream chat

What did you expect to happen?

Not crash in core data

What happened instead?

Occasionally, crash occurs accessing a property on a core data type on a background queue within the StreamChat SDK

GetStream Environment

GetStream Chat version: 4.66.0 GetStream Chat frameworks: StreamChat, StreamChatUI iOS version:

image

Swift version: 6 Xcode version: 16.1 Device: Healthy mix of devices – not specific to one or the other.

Additional context

Sample crash report:

OS Version: iOS 18.0.1 (22A3370)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 55

Application Specific Information:
-[_NSCoreDataTaggedObjectID id]: unrecognized selector sent to instance 0xaeeabdcf1f860195

Thread 55 Crashed:
0   CoreFoundation                  0x31a8de08c         __exceptionPreprocess
1   libobjc.A.dylib                 0x314f4f2e0         objc_exception_throw
2   CoreFoundation                  0x31a9e47c4         -[NSObject(NSObject) doesNotRecognizeSelector:]
3   CoreFoundation                  0x31a87b884         ___forwarding___
4   CoreFoundation                  0x31a87b1ac         __forwarding_prep_0___
5   Tolan                           0x2059e1348         TypingStartCleanupMiddleware.handle (TypingStartCleanupMiddleware.swift:32)
6   Tolan                           0x2059e18d4         TypingStartCleanupMiddleware
7   Tolan                           0x2059ddaf0         Array<T>.process (EventMiddleware.swift:31)
8   Tolan                           0x205b244f8         [inlined] closure in EventNotificationCenter.process (EventNotificationCenter.swift:51)
9   Tolan                           0x205b244f8         closure in EventNotificationCenter.process
10  Tolan                           0x205b0c278         Sequence.compactMap<T>
11  Tolan                           0x205b23928         closure in EventNotificationCenter.process (EventNotificationCenter.swift:50)
12  Tolan                           0x205b243b0         closure in EventNotificationCenter.process
13  Tolan                           0x20589d190         closure in DatabaseContainer.write (DatabaseContainer.swift:222)
14  Tolan                           0x2049dbcbc         thunk for closure
15  CoreData                        0x32a6f56e8         developerSubmittedBlockToNSManagedObjectContextPerform
16  libdispatch.dylib               0x32a2500cc         _dispatch_client_callout
17  libdispatch.dylib               0x32a2576d4         _dispatch_lane_serial_drain
18  libdispatch.dylib               0x32a2581dc         _dispatch_lane_invoke
19  libdispatch.dylib               0x32a263254         _dispatch_root_queue_drain_deferred_wlh
20  libdispatch.dylib               0x32a262aa0         _dispatch_workloop_worker_thread
21  libsystem_pthread.dylib         0x429032c78         _pthread_wqthread
22  libsystem_pthread.dylib         0x42902f484         start_wqthread

Thread 0
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   CoreFoundation                  0x31a8ae7c8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x31a8ade74         __CFRunLoopRun
6   CoreFoundation                  0x31a8ad5b4         CFRunLoopRunSpecific
7   GraphicsServices                0x3b1e2b1c0         GSEventRunModal
8   UIKitCore                       0x31fbce2bc         -[UIApplication _run]
9   UIKitCore                       0x31fc7cdd8         UIApplicationMain
10  SwiftUI                         0x323698800         closure in KitRendererCommon
11  SwiftUI                         0x323675e64         runApp<T>
12  SwiftUI                         0x323678d64         App.main
13  Tolan                           0x204ad3630         [inlined] PortolaApp.$main
14  Tolan                           0x204ad3630         main
15  <unknown>                       0x1bd2ecd34         <redacted>

Thread 1
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 2
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 3
0   libsystem_pthread.dylib         0x42902f480         start_wqthread

Thread 4
0   libsystem_kernel.dylib          0x3ba58d694         guarded_pwrite_np
1   libsqlite3.dylib                0x37517d6f0         sqlite3_sourceid
2   libsqlite3.dylib                0x375137e64         sqlite3_free_table
3   libsqlite3.dylib                0x375185d34         sqlite3_sourceid
4   libsqlite3.dylib                0x375137b84         sqlite3_free_table
5   libsqlite3.dylib                0x375128514         sqlite3_value_text
6   libsqlite3.dylib                0x3751280dc         sqlite3_value_text
7   libsqlite3.dylib                0x375101808         sqlite3_finalize
8   libsqlite3.dylib                0x375122544         sqlite3_step
9   libsqlite3.dylib                0x375117744         sqlite3_step
10  libsqlite3.dylib                0x3750f47c8         sqlite3_exec
11  CFNetwork                       0x31d25d554         -[NSURLStorageURLCacheDB execSQLStatement:onConnection:toCompletionWithRetry:writeLockHeld:]
12  CFNetwork                       0x31d3dcfb0         -[NSURLStorageURLCacheDB updateToCurrentSchema]
13  CFNetwork                       0x31d25b9d8         __CFURLCache::createAndOpenCacheDB
14  CFNetwork                       0x31d25b144         __CFURLCacheCopyResponseForRequestWithCompletionHandler
15  CFNetwork                       0x31d25ade8         CFXURLCache::getResponseForTask
16  CFNetwork                       0x31d240b0c         URLConnectionLoader::_loaderEvent_StartLoad
17  CFNetwork                       0x31d240484         -[NSURLSessionTask _withXURLCache:]
18  CFNetwork                       0x31d240080         URLConnectionLoader::_loaderEvent_StartLoad
19  CFNetwork                       0x31d2be634         -[__NSCFURLLocalSessionConnection _tick]
20  CFNetwork                       0x31d2b90cc         __71-[__NSCFURLLocalSessionConnection initWithTask:delegate:delegateQueue:]_block_invoke
21  libdispatch.dylib               0x32a25f2e4         _dispatch_block_async_invoke2
22  libdispatch.dylib               0x32a2500cc         _dispatch_client_callout
23  libdispatch.dylib               0x32a2576d4         _dispatch_lane_serial_drain
24  libdispatch.dylib               0x32a258210         _dispatch_lane_invoke
25  libdispatch.dylib               0x32a263254         _dispatch_root_queue_drain_deferred_wlh
26  libdispatch.dylib               0x32a262aa0         _dispatch_workloop_worker_thread
27  libsystem_pthread.dylib         0x429032c78         _pthread_wqthread

Thread 5
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 6
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 7
0   libsystem_kernel.dylib          0x3ba58d250         __semwait_signal
1   libsystem_c.dylib               0x32a2efa74         nanosleep
2   libsystem_c.dylib               0x32a34d54c         sleep
3   Tolan                           0x205bb3e60         monitorCachedData
4   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 8 name: SentryCrash Exception Handler (Secondary)
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba588c98         thread_suspend
3   Tolan                           0x205b9a038         handleExceptions
4   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 9 name: SentryCrash Exception Handler (Primary)
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   Tolan                           0x205b9a064         handleExceptions
5   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 10 name: io.sentry.app-hang-tracker
0   libsystem_kernel.dylib          0x3ba58d250         __semwait_signal
1   libsystem_c.dylib               0x32a2efa74         nanosleep
2   Foundation                      0x31828f738         +[NSThread sleepForTimeInterval:]
3   Tolan                           0x205b7a6fc         -[SentryANRTracker detectANRs]
4   Foundation                      0x318188154         __NSThread__start__
5   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 11 name: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   CoreFoundation                  0x31a8ae7c8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x31a8ade74         __CFRunLoopRun
6   CoreFoundation                  0x31a8ad5b4         CFRunLoopRunSpecific
7   Foundation                      0x318176ffc         -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
8   Foundation                      0x318176e4c         -[NSRunLoop(NSRunLoop) runUntilDate:]
9   UIKitCore                       0x31fbe1710         -[UIEventFetcher threadMain]
10  Foundation                      0x318188154         __NSThread__start__
11  libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 12
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 13
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 43 name: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   CoreFoundation                  0x31a8ae7c8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x31a8ade74         __CFRunLoopRun
6   CoreFoundation                  0x31a8ad5b4         CFRunLoopRunSpecific
7   CFNetwork                       0x31d2f3f40         +[__CFN_CoreSchedulingSetRunnable _run:]
8   Foundation                      0x318188154         __NSThread__start__
9   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 44 name: AudioSession - RootQueue
0   libsystem_kernel.dylib          0x3ba5876bc         semaphore_timedwait_trap
1   libdispatch.dylib               0x32a2506e4         _dispatch_sema4_timedwait
2   libdispatch.dylib               0x32a250ce4         _dispatch_semaphore_wait_slow
3   libdispatch.dylib               0x32a261b5c         _dispatch_worker_thread
4   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 45 name: caulk::deferred_logger
0   libsystem_kernel.dylib          0x3ba5876a4         semaphore_wait_trap
1   caulk                           0x42f134a08         caulk::semaphore::timed_wait
2   caulk                           0x42f1348c0         caulk::concurrent::details::worker_thread::run
3   caulk                           0x42f134808         caulk::thread_proxy<T>
4   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 46 name: caulk.messenger.shared:high
0   libsystem_kernel.dylib          0x3ba5876a4         semaphore_wait_trap
1   caulk                           0x42f134a08         caulk::semaphore::timed_wait
2   caulk                           0x42f1348c0         caulk::concurrent::details::worker_thread::run
3   caulk                           0x42f134808         caulk::thread_proxy<T>
4   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 48 name: AURemoteIO::IOThread
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   libEmbeddedSystemAUs.dylib      0x44521e3c4         caulk::thread_proxy<T>
5   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 50 name: com.apple.CoreMotion.MotionThread
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   CoreFoundation                  0x31a8ae7c8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x31a8ade74         __CFRunLoopRun
6   CoreFoundation                  0x31a8ad5b4         CFRunLoopRunSpecific
7   CoreFoundation                  0x31a91984c         CFRunLoopRun
8   CoreMotion                      0x33512e1e4         <redacted>
9   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 53 name: com.apple.CFStream.LegacyThread
0   libsystem_kernel.dylib          0x3ba587728         mach_msg2_trap
1   libsystem_kernel.dylib          0x3ba58ae34         mach_msg2_internal
2   libsystem_kernel.dylib          0x3ba58ad4c         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3ba58ab98         mach_msg
4   CoreFoundation                  0x31a8ae7c8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x31a8ade74         __CFRunLoopRun
6   CoreFoundation                  0x31a8ad5b4         CFRunLoopRunSpecific
7   CoreFoundation                  0x31a9171f8         _legacyStreamRunLoop_workThread
8   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 54
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 55 Crashed:
0   CoreFoundation                  0x31a8de08c         __exceptionPreprocess
1   libobjc.A.dylib                 0x314f4f2e0         objc_exception_throw
2   CoreFoundation                  0x31a9e47c4         -[NSObject(NSObject) doesNotRecognizeSelector:]
3   CoreFoundation                  0x31a87b884         ___forwarding___
4   CoreFoundation                  0x31a87b1ac         __forwarding_prep_0___
5   Tolan                           0x2059e1348         TypingStartCleanupMiddleware.handle (TypingStartCleanupMiddleware.swift:32)
6   Tolan                           0x2059e18d4         TypingStartCleanupMiddleware
7   Tolan                           0x2059ddaf0         Array<T>.process (EventMiddleware.swift:31)
8   Tolan                           0x205b244f8         [inlined] closure in EventNotificationCenter.process (EventNotificationCenter.swift:51)
9   Tolan                           0x205b244f8         closure in EventNotificationCenter.process
10  Tolan                           0x205b0c278         Sequence.compactMap<T>
11  Tolan                           0x205b23928         closure in EventNotificationCenter.process (EventNotificationCenter.swift:50)
12  Tolan                           0x205b243b0         closure in EventNotificationCenter.process
13  Tolan                           0x20589d190         closure in DatabaseContainer.write (DatabaseContainer.swift:222)
14  Tolan                           0x2049dbcbc         thunk for closure
15  CoreData                        0x32a6f56e8         developerSubmittedBlockToNSManagedObjectContextPerform
16  libdispatch.dylib               0x32a2500cc         _dispatch_client_callout
17  libdispatch.dylib               0x32a2576d4         _dispatch_lane_serial_drain
18  libdispatch.dylib               0x32a2581dc         _dispatch_lane_invoke
19  libdispatch.dylib               0x32a263254         _dispatch_root_queue_drain_deferred_wlh
20  libdispatch.dylib               0x32a262aa0         _dispatch_workloop_worker_thread
21  libsystem_pthread.dylib         0x429032c78         _pthread_wqthread
22  libsystem_pthread.dylib         0x42902f484         start_wqthread

Thread 56
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 57
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 58
0   libsystem_kernel.dylib          0x3ba5874b0         __workq_kernreturn
1   libsystem_pthread.dylib         0x429032cc4         _pthread_wqthread

Thread 59 name: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x3ba58f2d4         __select
1   CoreFoundation                  0x31a9174bc         __CFSocketManager
2   libsystem_pthread.dylib         0x429034378         _pthread_start

Thread 60 name: com.apple.audio.toolbox.AUScheduledParameterRefresher
0   libsystem_kernel.dylib          0x3ba5876a4         semaphore_wait_trap
1   caulk                           0x42f134a08         caulk::semaphore::timed_wait
2   caulk                           0x42f1348c0         caulk::concurrent::details::worker_thread::run
3   caulk                           0x42f134808         caulk::thread_proxy<T>
4   libsystem_pthread.dylib         0x429034378         _pthread_start
testableapple commented 2 days ago

Hi @dfed, thanks for opening the issue.

We are aware of this rare crash and are currently trying to find the root cause and the reproduction steps for a potential fix.

I will leave this ticket open and share an update with you as soon as this is fixed.

Thanks!