twilio/conversations-ios

Bug: Crash TwilsockTransport deallocated with non-zero retain count 2

Closed this issue · 7 comments

aryo commented

SDK version

4.0.2

Device model

iPhone & iPad, various models

OS version

iOS 16.5 - 17.2

Issue description

We've been getting a boat load of these crashes throughout various iOS versions and iPhone makes and models.

Have you guys seen this specific crash before? I can attach some more stack traces if needed.

Example stack traces

OS Version: iOS 17.0.3 (21A360)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 28

Application Specific Information:
Object 0x28123bd20 of class TwilsockTransport deallocated with non-zero retain count 2. This object's deinit, or something called from it, may have created a strong reference to self which outlived deinit, resulting in a dangling reference.


Thread 28 Crashed:
0   libsystem_kernel.dylib          0x3cd25401c         __pthread_kill
1   libsystem_pthread.dylib         0x411e6b67c         pthread_kill
2   libsystem_c.dylib               0x34f9e5bac         abort
3   libswiftCore.dylib              0x3327444d4         swift::fatalErrorv
4   libswiftCore.dylib              0x3327444f4         swift::fatalError
5   libswiftCore.dylib              0x332748ef4         swift_deallocClassInstance
6   libswiftCore.dylib              0x332748d84         _swift_release_dealloc
7   libswiftCore.dylib              0x33274a420         swift::RefCounts<T>::doDecrementSlow<T>
8   libswiftCore.dylib              0x332721dd8         ClosedRange<T>.Index
9   TwilioTwilsockLib               0x1019f3e84         TwilsockTransportProtocol?
10  TwilioTwilsockLib               0x1019ebe28         [inlined] Twilsock.transport.setter
11  TwilioTwilsockLib               0x1019ebe28         Twilsock.shutdownTransport (Twilsock.swift:356)
12  TwilioTwilsockLib               0x1019e8d88         Twilsock.init (Twilsock.swift:158)
13  TwilioTwilsockLib               0x1019e8278         [inlined] Sequence.forEach
14  TwilioTwilsockLib               0x1019e8278         Twilsock.init (Twilsock.swift:137)
15  TwilioStateMachine              0x100be2228         StateMachine.notify (StateMachine.swift:167)
16  TwilioStateMachine              0x100be1af8         StateMachine.transition
17  TwilioStateMachine              0x100be4704         StateMachine.transition
18  TwilioStateMachine              0x100be4720         [inlined] StateMachine.transition (StateMachine.swift:156)
19  TwilioStateMachine              0x100be4720         StateMachine.transition
20  libswiftDispatch.dylib          0x3521e9590         thunk for closure
21  libswiftDispatch.dylib          0x3521e956c         thunk for closure
22  libswiftDispatch.dylib          0x3521e94ac         OS_dispatch_queue._syncHelper<T>
23  libswiftDispatch.dylib          0x3521e93e4         thunk for closure
24  libswiftDispatch.dylib          0x3521e93bc         thunk for closure
25  libdispatch.dylib               0x34f8e62fc         _dispatch_client_callout
26  libdispatch.dylib               0x34f8f56b0         _dispatch_lane_barrier_sync_invoke_and_complete
27  libswiftDispatch.dylib          0x3521ea074         OS_dispatch_queue.asyncAndWait<T>
28  libswiftDispatch.dylib          0x3521e9fac         OS_dispatch_queue.sync<T>
29  libswiftDispatch.dylib          0x3521e9e2c         OS_dispatch_queue._syncHelper<T>
30  libswiftDispatch.dylib          0x3521e9c70         OS_dispatch_queue.asyncAndWait<T>
31  libswiftDispatch.dylib          0x3521e9bdc         OS_dispatch_queue.sync<T>
32  TwilioStateMachine              0x100be11d8         StateMachine.transition (StateMachine.swift:156)
33  TwilioStateMachine              0x100be49dc         StateMachine.transition
34  TwilioTwilsockLib               0x1019e76fc         StateMachine.safeTransition (Twilsock.swift:638)
35  TwilioTwilsockLib               0x1019ed628         Twilsock.handle (Twilsock.swift:445)
36  TwilioTwilsockLib               0x1019f0d14         Twilsock.handleMessageReceived (Twilsock.swift:581)
37  TwilioTwilsockLib               0x1019de70c         thunk for closure
38  libdispatch.dylib               0x34f8e46a4         _dispatch_call_block_and_release
39  libdispatch.dylib               0x34f8e62fc         _dispatch_client_callout
40  libdispatch.dylib               0x34f8f7db8         _dispatch_root_queue_drain
41  libdispatch.dylib               0x34f8f83e8         _dispatch_worker_thread2
42  libsystem_pthread.dylib         0x411e67924         _pthread_wqthread

Thread 0
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24ae84         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3cd24acc4         mach_msg
4   CoreFoundation                  0x33fac44b8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x33fac23b0         __CFRunLoopRun
6   CoreFoundation                  0x33fac1e14         CFRunLoopRunSpecific
7   GraphicsServices                0x3c507b5e8         GSEventRunModal
8   UIKitCore                       0x3440e32f8         -[UIApplication _run]
9   UIKitCore                       0x3440e2934         UIApplicationMain
10  Spoke Phone                     0x200753fcc         main (main.m:7)
11  <unknown>                       0x1da5afd44         <redacted>

Thread 1 name: com.apple.uikit.eventfetch-thread
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24ae84         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3cd24acc4         mach_msg
4   CoreFoundation                  0x33fac44b8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x33fac23b0         __CFRunLoopRun
6   CoreFoundation                  0x33fac1e14         CFRunLoopRunSpecific
7   Foundation                      0x33d9f14c8         -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
8   Foundation                      0x33da20230         -[NSRunLoop(NSRunLoop) runUntilDate:]
9   UIKitCore                       0x3440451b4         -[UIEventFetcher threadMain]
10  Foundation                      0x33da77150         __NSThread__start__
11  libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 2 name: com.facebook.react.JavaScript
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24ae84         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3cd24acc4         mach_msg
4   CoreFoundation                  0x33fac44b8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x33fac23b0         __CFRunLoopRun
6   CoreFoundation                  0x33fac1e14         CFRunLoopRunSpecific
7   Spoke Phone                     0x2007a8b24         +[RCTCxxBridge runRunLoop] (RCTCxxBridge.mm:324)
8   Foundation                      0x33da77150         __NSThread__start__
9   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 3
0   libsystem_kernel.dylib          0x3cd24b9d8         __semwait_signal
1   libsystem_c.dylib               0x34f97a0f8         nanosleep
2   libsystem_c.dylib               0x34f988394         sleep
3   Spoke Phone                     0x200886fe0         monitorCachedData (SentryCrashCachedData.c:139)
4   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 4 name: SentryCrash Exception Handler (Secondary)
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24f774         thread_suspend
3   Spoke Phone                     0x2008929a8         handleExceptions (SentryCrashMonitor_MachException.c:258)
4   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 5 name: SentryCrash Exception Handler (Primary)
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24ae84         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3cd24acc4         mach_msg
4   Spoke Phone                     0x2008929d4         handleExceptions (SentryCrashMonitor_MachException.c:266)
5   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 6 name: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24ae84         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3cd24acc4         mach_msg
4   CoreFoundation                  0x33fac44b8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x33fac23b0         __CFRunLoopRun
6   CoreFoundation                  0x33fac1e14         CFRunLoopRunSpecific
7   CFNetwork                       0x341e70794         _CFURLStorageSessionCopyIdentifier
8   Foundation                      0x33da77150         __NSThread__start__
9   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 7
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   libc++.1.dylib                  0x35fb02f5c         std::__1::condition_variable::__do_timed_wait
3   TwilioConversationsClient       0x1013f03e4         [inlined] std::__1::condition_variable::wait_for<T>
4   TwilioConversationsClient       0x1013f03e4         [inlined] std::__1::condition_variable::__do_timed_wait<T> (__mutex_base:512)
5   TwilioConversationsClient       0x1013f03e4         [inlined] std::__1::condition_variable::wait_until<T> (__mutex_base:415)
6   TwilioConversationsClient       0x1013f03e4         [inlined] std::__1::condition_variable::wait_until<T> (__mutex_base:427)
7   TwilioConversationsClient       0x1013f03e4         [inlined] std::__1::condition_variable::wait_for[abi:v15006]<T> (__mutex_base:471)
8   TwilioConversationsClient       0x1013f03e4         [inlined] spdlog::details::mpmc_blocking_queue<T>::dequeue_for (mpmc_blocking_q.h:61)
9   TwilioConversationsClient       0x1013f03e4         [inlined] spdlog::details::thread_pool::process_next_msg_ (thread_pool.h:207)
10  TwilioConversationsClient       0x1013f03e4         spdlog::details::thread_pool::worker_loop_ (thread_pool.h:198)
11  TwilioConversationsClient       0x1013f085c         [inlined] std::__1::__invoke[abi:v15006]<T> (invoke.h:359)
12  TwilioConversationsClient       0x1013f085c         [inlined] std::__1::__thread_execute[abi:v15006]<T> (thread:290)
13  TwilioConversationsClient       0x1013f085c         std::__1::__thread_proxy[abi:v15006]<T> (thread:301)
14  libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 8 name: ThreadedExecutor0@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 9 name: ThreadedExecutor1@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 10 name: ThreadedExecutor2@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 11 name: ThreadedExecutor3@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 12 name: ThreadedExecutor4@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 13 name: ThreadedExecutor5@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 14 name: ThreadedExecutor6@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 15 name: ThreadedExecutor7@0x2838e1278
0   libsystem_kernel.dylib          0x3cd258f6c         kevent
1   TwilioConversationsClient       0x1012e4598         boost::asio::detail::kqueue_reactor::run
2   TwilioConversationsClient       0x1012e4338         boost::asio::detail::scheduler::do_run_one
3   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
4   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
5   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
6   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 16 name: ThreadedExecutor8@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 17 name: ThreadedExecutor9@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 18 name: ThreadedExecutor10@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 19 name: ThreadedExecutor11@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 20 name: ThreadedExecutor12@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 21 name: ThreadedExecutor13@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 22 name: ThreadedExecutor14@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 23 name: ThreadedExecutor15@0x2838e1278
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 24
0   libsystem_kernel.dylib          0x3cd253730         __workq_kernreturn
1   libsystem_pthread.dylib         0x411e679ac         _pthread_wqthread

Thread 25 name: com.squareup.SocketRocket.NetworkThread
0   libsystem_kernel.dylib          0x3cd24b1d8         mach_msg2_trap
1   libsystem_kernel.dylib          0x3cd24af6c         mach_msg2_internal
2   libsystem_kernel.dylib          0x3cd24ae84         mach_msg_overwrite
3   libsystem_kernel.dylib          0x3cd24acc4         mach_msg
4   CoreFoundation                  0x33fac44b8         __CFRunLoopServiceMachPort
5   CoreFoundation                  0x33fac23b0         __CFRunLoopRun
6   CoreFoundation                  0x33fac1e14         CFRunLoopRunSpecific
7   Foundation                      0x33d9f14c8         -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
8   Spoke Phone                     0x2007debd4         -[_RCTSRRunLoopThread main] (RCTSRWebSocket.m:1620)
9   Foundation                      0x33da77150         __NSThread__start__
10  libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 26 name: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x3cd2578c0         __select
1   CoreFoundation                  0x33fb6e6e0         __CFSocketManager
2   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 27
0   libsystem_kernel.dylib          0x3cd253730         __workq_kernreturn
1   libsystem_pthread.dylib         0x411e679ac         _pthread_wqthread

Thread 28 Crashed:
0   libsystem_kernel.dylib          0x3cd25401c         __pthread_kill
1   libsystem_pthread.dylib         0x411e6b67c         pthread_kill
2   libsystem_c.dylib               0x34f9e5bac         abort
3   libswiftCore.dylib              0x3327444d4         swift::fatalErrorv
4   libswiftCore.dylib              0x3327444f4         swift::fatalError
5   libswiftCore.dylib              0x332748ef4         swift_deallocClassInstance
6   libswiftCore.dylib              0x332748d84         _swift_release_dealloc
7   libswiftCore.dylib              0x33274a420         swift::RefCounts<T>::doDecrementSlow<T>
8   libswiftCore.dylib              0x332721dd8         ClosedRange<T>.Index
9   TwilioTwilsockLib               0x1019f3e84         TwilsockTransportProtocol?
10  TwilioTwilsockLib               0x1019ebe28         [inlined] Twilsock.transport.setter
11  TwilioTwilsockLib               0x1019ebe28         Twilsock.shutdownTransport (Twilsock.swift:356)
12  TwilioTwilsockLib               0x1019e8d88         Twilsock.init (Twilsock.swift:158)
13  TwilioTwilsockLib               0x1019e8278         [inlined] Sequence.forEach
14  TwilioTwilsockLib               0x1019e8278         Twilsock.init (Twilsock.swift:137)
15  TwilioStateMachine              0x100be2228         StateMachine.notify (StateMachine.swift:167)
16  TwilioStateMachine              0x100be1af8         StateMachine.transition
17  TwilioStateMachine              0x100be4704         StateMachine.transition
18  TwilioStateMachine              0x100be4720         [inlined] StateMachine.transition (StateMachine.swift:156)
19  TwilioStateMachine              0x100be4720         StateMachine.transition
20  libswiftDispatch.dylib          0x3521e9590         thunk for closure
21  libswiftDispatch.dylib          0x3521e956c         thunk for closure
22  libswiftDispatch.dylib          0x3521e94ac         OS_dispatch_queue._syncHelper<T>
23  libswiftDispatch.dylib          0x3521e93e4         thunk for closure
24  libswiftDispatch.dylib          0x3521e93bc         thunk for closure
25  libdispatch.dylib               0x34f8e62fc         _dispatch_client_callout
26  libdispatch.dylib               0x34f8f56b0         _dispatch_lane_barrier_sync_invoke_and_complete
27  libswiftDispatch.dylib          0x3521ea074         OS_dispatch_queue.asyncAndWait<T>
28  libswiftDispatch.dylib          0x3521e9fac         OS_dispatch_queue.sync<T>
29  libswiftDispatch.dylib          0x3521e9e2c         OS_dispatch_queue._syncHelper<T>
30  libswiftDispatch.dylib          0x3521e9c70         OS_dispatch_queue.asyncAndWait<T>
31  libswiftDispatch.dylib          0x3521e9bdc         OS_dispatch_queue.sync<T>
32  TwilioStateMachine              0x100be11d8         StateMachine.transition (StateMachine.swift:156)
33  TwilioStateMachine              0x100be49dc         StateMachine.transition
34  TwilioTwilsockLib               0x1019e76fc         StateMachine.safeTransition (Twilsock.swift:638)
35  TwilioTwilsockLib               0x1019ed628         Twilsock.handle (Twilsock.swift:445)
36  TwilioTwilsockLib               0x1019f0d14         Twilsock.handleMessageReceived (Twilsock.swift:581)
37  TwilioTwilsockLib               0x1019de70c         thunk for closure
38  libdispatch.dylib               0x34f8e46a4         _dispatch_call_block_and_release
39  libdispatch.dylib               0x34f8e62fc         _dispatch_client_callout
40  libdispatch.dylib               0x34f8f7db8         _dispatch_root_queue_drain
41  libdispatch.dylib               0x34f8f83e8         _dispatch_worker_thread2
42  libsystem_pthread.dylib         0x411e67924         _pthread_wqthread

Thread 29
0   libsystem_kernel.dylib          0x3cd253730         __workq_kernreturn
1   libsystem_pthread.dylib         0x411e679ac         _pthread_wqthread

Thread 30
0   libsystem_kernel.dylib          0x3cd253730         __workq_kernreturn
1   libsystem_pthread.dylib         0x411e679ac         _pthread_wqthread

Thread 31
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36bdd8d54         scavenger_thread_main
3   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 32
0   libsystem_kernel.dylib          0x3cd24bc2c         kevent_id
1   libdispatch.dylib               0x34f908b0c         _dispatch_kq_poll
2   libdispatch.dylib               0x34f9094dc         _dispatch_event_loop_wait_for_ownership
3   libdispatch.dylib               0x34f8f5980         __DISPATCH_WAIT_FOR_QUEUE__
4   libdispatch.dylib               0x34f8f5548         _dispatch_sync_f_slow
5   libswiftDispatch.dylib          0x3521ea074         OS_dispatch_queue.asyncAndWait<T>
6   libswiftDispatch.dylib          0x3521e9fac         OS_dispatch_queue.sync<T>
7   libswiftDispatch.dylib          0x3521e9e2c         OS_dispatch_queue._syncHelper<T>
8   libswiftDispatch.dylib          0x3521e9c70         OS_dispatch_queue.asyncAndWait<T>
9   libswiftDispatch.dylib          0x3521e9bdc         OS_dispatch_queue.sync<T>
10  TwilioStateMachine              0x100be11d8         StateMachine.transition (StateMachine.swift:156)
11  TwilioStateMachine              0x100be49dc         StateMachine.transition
12  TwilioTwilsockLib               0x1019e76fc         StateMachine.safeTransition (Twilsock.swift:638)
13  TwilioTwilsockLib               0x1019ef030         Twilsock.handle (Twilsock.swift:496)
14  TwilioTwilsockLib               0x1019f0c7c         Twilsock.handleMessageReceived (Twilsock.swift:583)
15  TwilioTwilsockLib               0x1019de70c         thunk for closure
16  libdispatch.dylib               0x34f8e46a4         _dispatch_call_block_and_release
17  libdispatch.dylib               0x34f8e62fc         _dispatch_client_callout
18  libdispatch.dylib               0x34f8f7db8         _dispatch_root_queue_drain
19  libdispatch.dylib               0x34f8f83e8         _dispatch_worker_thread2
20  libsystem_pthread.dylib         0x411e67924         _pthread_wqthread

Thread 33
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36a8a2220         WTF::ThreadCondition::timedWait
3   JavaScriptCore                  0x36a87bf50         WTF::ParkingLot::parkConditionallyImpl
4   JavaScriptCore                  0x36a83c78c         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x36a89f498         WTF::Thread::entryPoint
6   JavaScriptCore                  0x36a8a1960         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 34
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36a8a2220         WTF::ThreadCondition::timedWait
3   JavaScriptCore                  0x36a87bf50         WTF::ParkingLot::parkConditionallyImpl
4   JavaScriptCore                  0x36a83c78c         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x36a89f498         WTF::Thread::entryPoint
6   JavaScriptCore                  0x36a8a1960         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 35
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36a8a2220         WTF::ThreadCondition::timedWait
3   JavaScriptCore                  0x36a87bf50         WTF::ParkingLot::parkConditionallyImpl
4   JavaScriptCore                  0x36a83c78c         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x36a89f498         WTF::Thread::entryPoint
6   JavaScriptCore                  0x36a8a1960         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 36
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36a8a2220         WTF::ThreadCondition::timedWait
3   JavaScriptCore                  0x36a87bf50         WTF::ParkingLot::parkConditionallyImpl
4   JavaScriptCore                  0x36a83c78c         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x36a89f498         WTF::Thread::entryPoint
6   JavaScriptCore                  0x36a8a1960         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 37
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36a8a2220         WTF::ThreadCondition::timedWait
3   JavaScriptCore                  0x36a87bf50         WTF::ParkingLot::parkConditionallyImpl
4   JavaScriptCore                  0x36a83c78c         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x36a89f498         WTF::Thread::entryPoint
6   JavaScriptCore                  0x36a8a1960         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 38
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   JavaScriptCore                  0x36a8a2220         WTF::ThreadCondition::timedWait
3   JavaScriptCore                  0x36a87bf50         WTF::ParkingLot::parkConditionallyImpl
4   JavaScriptCore                  0x36a83c78c         WTF::Detail::CallableWrapper<T>::call
5   JavaScriptCore                  0x36a89f498         WTF::Thread::entryPoint
6   JavaScriptCore                  0x36a8a1960         WTF::wtfThreadEntryPoint
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 39
0   libsystem_kernel.dylib          0x3cd258f6c         kevent
1   TwilioConversationsClient       0x1012e4598         boost::asio::detail::kqueue_reactor::run
2   TwilioConversationsClient       0x1012e4338         boost::asio::detail::scheduler::do_run_one
3   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
4   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
5   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
6   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 40
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 41
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 42
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 43
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 44
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
4   TwilioConversationsClient       0x1012e412c         boost::asio::detail::scheduler::run
5   TwilioConversationsClient       0x1012e30a0         rtd::executors::ThreadedExecutor::Impl::process_events
6   TwilioConversationsClient       0x1012ea3bc         std::__1::__thread_proxy[abi:v15006]<T>
7   libsystem_pthread.dylib         0x411e684d0         _pthread_start

Thread 45
0   libsystem_kernel.dylib          0x3cd24bb7c         __psynch_cvwait
1   libsystem_pthread.dylib         0x411e66fd0         _pthread_cond_wait
2   TwilioConversationsClient       0x1012e4b90         boost::asio::detail::posix_event::wait<T>
3   TwilioConversationsClient       0x1012e4300         boost::asio::detail::scheduler::do_run_one
berkus commented

Could you please try with 4.0.3?

aryo commented

We just released a new version today that has 4.0.3.. will post an update within the next couple days or so as people upgrade.

aryo commented

So far it's been almost a week without this crash, so I will close this issue.

aryo commented

@berkus Just on a slightly unrelated note.. have you guys stopped publishing to CocoaPods? I can see on the same release day for 4.0.3 that its dep TwilioTwilSockLib 2.0.4 was published (CocoaPods/Specs@a8228f9), but not TwilioConversationsClient 4.0.3.

Could it be a CocoaPods trunk deploy issue?

berkus commented

@aryo yep, we switched to SPM distribution only at the moment.

@berkus long shot but we're seeing a lot of these errors but with _DictionaryStorage getting deallocated with a non-zero retain count. this is the only reference to this sort of error on the web. do you remember what the issue here was that you fixed?

@aeioliu it was multithreading race.