SessionWebSocketEngine iOS crash v4.24.0

[Problem/Question]
We’re seeing some crashers come in on Line 165 of SessionWebSocketEngine with the version 4.24.0 of the SDK


// If problem, please fill out the below. If question, please delete.
[SDK Version]
4.24.0

[Reproduction Steps]
Can’t repro, but all crashes are retrieved via Firebase Crashlytics in production.

[Frequency]
65 crash starting from friday 24/10/2025

[Current impact]
Our application crash for our users.

# Crashlytics - Stack trace
# Platform: apple
# Version: 4.330.0 (202501211654)
# Issue: 1742759b0b8b1fd33c56d75738f43f57
# Session: c4cf8a16845f4062817f817b2f1d05c0_DNE_7_v2
# Date: Mon Jan 27 2025 12:48:55 GMT+0100 (heure normale d’Europe centrale)

com.apple.main-thread
0  libsystem_kernel.dylib         0x1788 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x4e98 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4db0 mach_msg_overwrite + 424
3  libsystem_kernel.dylib         0x4bfc mach_msg + 24
4  CoreFoundation                 0x767f4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x75ea0 __CFRunLoopRun + 1212
6  CoreFoundation                 0xc8274 CFRunLoopRunSpecific + 588
7  GraphicsServices               0x14c0 GSEventRunModal + 164
8  UIKitCore                      0x3ee77c -[UIApplication _run] + 816
9  UIKitCore                      0x14e64 UIApplicationMain + 340
10 UIKitCore                      0x751a7c keypath_get_selector_hoverStyle + 15924
11 MyBoutique                     0x7cf1ec main + 116 (AppDelegate.swift:116)
12 ???                            0x1bce64de8 (Manquant)

com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1788 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x4e98 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4db0 mach_msg_overwrite + 424
3  libsystem_kernel.dylib         0x4bfc mach_msg + 24
4  CoreFoundation                 0x767f4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x75ea0 __CFRunLoopRun + 1212
6  CoreFoundation                 0xc8274 CFRunLoopRunSpecific + 588
7  Foundation                     0x29b48 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  Foundation                     0x1866f4 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64
9  UIKitCore                      0x481b80 -[UIEventFetcher threadMain] + 420
10 Foundation                     0x115a54 __NSThread__start__ + 724
11 libsystem_pthread.dylib        0x17d0 _pthread_start + 136
12 libsystem_pthread.dylib        0x1480 thread_start + 8

com.google.firebase.crashlytics.MachExceptionServer
0  MBAnalyticsKit                 0xfd0ec FIRCLSProcessRecordAllThreads + 184
1  MBAnalyticsKit                 0xfd4d0 FIRCLSProcessRecordAllThreads + 1180
2  MBAnalyticsKit                 0x10b690 FIRCLSHandler + 48
3  MBAnalyticsKit                 0x10bec0 FIRCLSMachExceptionServer + 688
4  libsystem_pthread.dylib        0x17d0 _pthread_start + 136
5  libsystem_pthread.dylib        0x1480 thread_start + 8

com.sendbird.core.runloop.thread
0  libsystem_kernel.dylib         0x1788 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x4e98 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4db0 mach_msg_overwrite + 424
3  libsystem_kernel.dylib         0x4bfc mach_msg + 24
4  CoreFoundation                 0x767f4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x75ea0 __CFRunLoopRun + 1212
6  CoreFoundation                 0xc8274 CFRunLoopRunSpecific + 588
7  Foundation                     0x29b48 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
8  SendbirdChatSDK                0x326470 SBRunloopThread.main() + 61 (Runloop+SBTimer.swift:61)
9  SendbirdChatSDK                0x3264e4 @objc SBRunloopThread.main() + 4432913636 (<compiler-generated>:4432913636)
10 Foundation                     0x115a54 __NSThread__start__ + 724
11 libsystem_pthread.dylib        0x17d0 _pthread_start + 136
12 libsystem_pthread.dylib        0x1480 thread_start + 8

com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1788 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x4e98 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x4db0 mach_msg_overwrite + 424
3  libsystem_kernel.dylib         0x4bfc mach_msg + 24
4  CoreFoundation                 0x767f4 __CFRunLoopServiceMachPort + 160
5  CoreFoundation                 0x75ea0 __CFRunLoopRun + 1212
6  CoreFoundation                 0xc8274 CFRunLoopRunSpecific + 588
7  CFNetwork                      0xf2020 +[__CFN_CoreSchedulingSetRunnable _run:] + 416
8  Foundation                     0x115a54 __NSThread__start__ + 724
9  libsystem_pthread.dylib        0x17d0 _pthread_start + 136
10 libsystem_pthread.dylib        0x1480 thread_start + 8

Thread
0  libsystem_kernel.dylib         0x1704 semaphore_wait_trap + 8
1  libdispatch.dylib              0x4544 _dispatch_sema4_wait + 28
2  libdispatch.dylib              0x4bf8 _dispatch_semaphore_wait_slow + 132
3  UIKitCore                      0x509a40 UICollectionViewFlowLayoutBreakForInvalidSizes + 26052
4  UIKitCore                      0x2f9610 -[_UIAppCACommitFuture _invoke] + 176
5  Foundation                     0x115a54 __NSThread__start__ + 724
6  libsystem_pthread.dylib        0x17d0 _pthread_start + 136
7  libsystem_pthread.dylib        0x1480 thread_start + 8

Thread
0  libsystem_kernel.dylib         0x1510 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x36cc _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x1474 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1510 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x36cc _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x1474 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1510 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x36cc _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x1474 start_wqthread + 8

Crashed: com.sendbird.core.networking.websocket.connect
0  libobjc.A.dylib                0xdd00 objc_loadWeakRetained + 180
1  SendbirdChatSDK                0x380eb8 closure #1 in SessionWebSocketEngine.didReceiveListenResult(from:result:) + 165 (SessionWebSocketEngine.swift:165)
2  SendbirdChatSDK                0x18150 thunk for @escaping @callee_guaranteed @Sendable () -> () + 4429709648 (<compiler-generated>:4429709648)
3  libdispatch.dylib              0x2248 _dispatch_call_block_and_release + 32
4  libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
5  libdispatch.dylib              0xb5cc _dispatch_lane_serial_drain + 768
6  libdispatch.dylib              0xc124 _dispatch_lane_invoke + 380
7  libdispatch.dylib              0x1738c _dispatch_root_queue_drain_deferred_wlh + 288
8  libdispatch.dylib              0x16bd8 _dispatch_workloop_worker_thread + 540
9  libsystem_pthread.dylib        0x3680 _pthread_wqthread + 288
10 libsystem_pthread.dylib        0x1474 start_wqthread + 8

com.apple.CFNetwork.Connection
0  libsystem_kernel.dylib         0x159c __ulock_wait2 + 8
1  libsystem_platform.dylib       0x1d9c _os_unfair_lock_lock_slow + 180
2  libobjc.A.dylib                0x58d8 objc_object::sidetable_clearDeallocating() + 88
3  libobjc.A.dylib                0x4f98 objc_destructInstance + 156
4  libsystem_blocks.dylib         0x1e58 _Block_release + 272
5  Network                        0x11d23c nw_resolver_cancel + 408
6  Network                        0x180eb0 -[NWConcrete_nw_endpoint_resolver cancelWithHandler:forced:] + 212
7  Network                        0x178660 nw_endpoint_handler_cancel + 1160
8  Network                        0x74efd8 __57-[NWConcrete_nw_endpoint_proxy cancelWithHandler:forced:]_block_invoke + 28
9  Network                        0x5034 nw_array_apply + 124
10 Network                        0x74eb94 -[NWConcrete_nw_endpoint_proxy cancelWithHandler:forced:] + 1340
11 Network                        0x178660 nw_endpoint_handler_cancel + 1160
12 Network                        0x1230f8 -[NWConcrete_nw_endpoint_flow cancelWithHandler:forced:] + 392
13 Network                        0x178660 nw_endpoint_handler_cancel + 1160
14 Network                        0x1776f4 invocation function for block in nw_connection_cancel_inner(NWConcrete_nw_connection*, bool) + 2320
15 Network                        0xa02f4 nw_connection_async_if_needed + 76
16 Network                        0x9ddf8 nw_connection_cancel_inner(NWConcrete_nw_connection*, bool) + 240
17 Network                        0x9da6c nw_connection_cancel + 112
18 CFNetwork                      0xb51a8 NWIOConnection::_cleanupConnection(bool) + 1288
19 CFNetwork                      0x7c9c4 Tube::_onqueue_cleanupConnection() + 236
20 CFNetwork                      0x78ff8 invocation function for block in Tube::_onqueue_cancel() + 76
21 libdispatch.dylib              0x2248 _dispatch_call_block_and_release + 32
22 libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
23 libdispatch.dylib              0xb5cc _dispatch_lane_serial_drain + 768
24 libdispatch.dylib              0xc158 _dispatch_lane_invoke + 432
25 libdispatch.dylib              0xd5c0 _dispatch_workloop_invoke + 1744
26 libdispatch.dylib              0x1738c _dispatch_root_queue_drain_deferred_wlh + 288
27 libdispatch.dylib              0x16bd8 _dispatch_workloop_worker_thread + 540
28 libsystem_pthread.dylib        0x3680 _pthread_wqthread + 288
29 libsystem_pthread.dylib        0x1474 start_wqthread + 8

AtomicProperty_81CBFD57-764F-49E6-927A-C41AFD1F5672_Optional<ChatWebSocketEngine>
0  libsystem_kernel.dylib         0x159c __ulock_wait2 + 8
1  libsystem_platform.dylib       0x1d9c _os_unfair_lock_lock_slow + 180
2  libobjc.A.dylib                0x81d0 objc_destroyWeak + 92
3  libobjc.A.dylib                0x5bac object_cxxDestructFromClass(objc_object*, objc_class*) + 116
4  libobjc.A.dylib                0x4f4c objc_destructInstance + 80
5  libobjc.A.dylib                0x4eec _objc_rootDealloc + 80
6  MBAnalyticsKit                 0x13b9b8 -[FPRObjectSwizzler dealloc] + 368
7  libobjc.A.dylib                0x53b0 _object_remove_associations + 1020
8  libobjc.A.dylib                0x4f5c objc_destructInstance + 96
9  libobjc.A.dylib                0x4eec _objc_rootDealloc + 80
10 SendbirdChatSDK                0x37f914 SessionWebSocketEngine.__deallocating_deinit + 45 (SessionWebSocketEngine.swift:45)
11 SendbirdChatSDK                0x37f93c @objc SessionWebSocketEngine.__deallocating_deinit + 4433279292 (<compiler-generated>:4433279292)
12 SendbirdChatSDK                0x145940 specialized Atomic.internalValue.setter + 14 (Atomic.swift:14)
13 SendbirdChatSDK                0x148108 specialized closure #1 in Atomic.wrappedValue.setter + 26 (Atomic.swift:26)
14 SendbirdChatSDK                0x18150 thunk for @escaping @callee_guaranteed @Sendable () -> () + 4429709648 (<compiler-generated>:4429709648)
15 libdispatch.dylib              0x2248 _dispatch_call_block_and_release + 32
16 libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
17 libdispatch.dylib              0xb5cc _dispatch_lane_serial_drain + 768
18 libdispatch.dylib              0xc124 _dispatch_lane_invoke + 380
19 libdispatch.dylib              0x1738c _dispatch_root_queue_drain_deferred_wlh + 288
20 libdispatch.dylib              0x16bd8 _dispatch_workloop_worker_thread + 540
21 libsystem_pthread.dylib        0x3680 _pthread_wqthread + 288
22 libsystem_pthread.dylib        0x1474 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1510 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x36cc _pthread_wqthread + 364
2  libsystem_pthread.dylib        0x1474 start_wqthread + 8

Hi there. @tarikalaoui

We are working to release a new version of the iOS SDK that addresses this crash. The current release target is to be within next week.

1 Like