twilio/conversations-ios

Crashes on 4.0.2

brian-voong opened this issue ยท 16 comments

Anyone else seeing new crashes for v4.0.2? We went from using v2.2.5 to this newer version in hopes of resolving crashes in the old version of the SDK. I think what we're seeing now are new crashes related to v4. Let us know if we're initializing or using the SDK incorrectly.

Thanks.

App Hang: The app was terminated while unresponsive

0  libsystem_kernel.dylib +0x12fc      _kevent_id
1  libdispatch.dylib +0x26f18          __dispatch_kq_poll
2  libdispatch.dylib +0x2793c          __dispatch_event_loop_wait_for_ownership
3  libdispatch.dylib +0x13840          ___DISPATCH_WAIT_FOR_QUEUE__
4  libdispatch.dylib +0x13408          __dispatch_sync_f_slow
5  libswiftDispatch.dylib +0x203c      implicit closure #2 in implicit closure #1 in OS_dispatch_queue.sync<A>(execute:)
6  libswiftDispatch.dylib +0x105c      partial apply for implicit closure #2 in implicit closure #1 in OS_dispatch_queue.sync<A>(execute:)
7  libswiftDispatch.dylib +0x1d4c      OS_dispatch_queue._syncHelper<A>(fn:execute:rescue:)
8  libswiftDispatch.dylib +0x1108      OS_dispatch_queue.sync<A>(execute:)
9  TwilioStateMachine +0x91d8          StateMachine.transition(_:)
10 TwilioStateMachine +0xc9dc          dispatch thunk of StateMachine.transition(_:)
11 TwilioTwilsockLib +0xf6fc           specialized StateMachine.safeTransition(_:)
12 TwilioTwilsockLib +0x11610          Twilsock.connect()
...
EXC_BAD_ACCESS: Attempted to dereference garbage pointer 0x1483172fbc18.

0 TwilioTwilsockLib +0x45088     protocol witness for TwilsockTransportProtocol.sendMessage(data:) in conformance TwilsockTransport
1 TwilioTwilsockLib +0x168f8     Twilsock.handle(closeMessage:)
2 TwilioTwilsockLib +0x18c7c     closure #1 in Twilsock.handleMessageReceived(_:)
3 TwilioTwilsockLib +0x670c      thunk for @escaping @callee_guaranteed () -> ()
4 libdispatch.dylib +0x231c      __dispatch_call_block_and_release
5 libdispatch.dylib +0x3ea8      __dispatch_client_callout
6 libdispatch.dylib +0x15a60     __dispatch_root_queue_drain
7 libdispatch.dylib +0x16154     __dispatch_worker_thread2
8 libsystem_pthread.dylib +0xd9c __pthread_wqthread
SIGABRT outlined assign with copy of TwilsockTransportProtocol?

0  libsystem_kernel.dylib +0x7578  ___pthread_kill
1  libsystem_pthread.dylib +0x7114 _pthread_kill
2  libsystem_c.dylib +0x1d174      _abort
3  libswiftCore.dylib +0x3b8b94    swift::fatalErrorv(unsigned int, char const*, char*)
4  libswiftCore.dylib +0x3b8bb4    swift::fatalError(unsigned int, char const*, ...)
5  libswiftCore.dylib +0x3bd7c4    _swift_deallocClassInstance
6  libswiftCore.dylib +0x3bd614    __swift_release_dealloc
7  libswiftCore.dylib +0x3be438    bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int)
8  libswiftCore.dylib +0x399d3c    assignWithCopy for ClosedRange<>.Index
9  TwilioTwilsockLib +0x1be84      outlined assign with copy of TwilsockTransportProtocol?
10 TwilioTwilsockLib +0x13e28      Twilsock.shutdownTransport()
11 TwilioTwilsockLib +0x10d88      closure #1 in closure #5 in Twilsock.init(certificates:authStruct:clientMetadata:notificationProductId:continuationTokenStorage:reachabilityMonitor:transportConfig:transportType:)
12 TwilioTwilsockLib +0x10278      closure #5 in Twilsock.init(certificates:authStruct:clientMetadata:notificationProductId:continuationTokenStorage:reachabilityMonitor:transportConfig:transportType:)
13 TwilioStateMachine +0xa228      StateMachine.notify(_:)
14 TwilioStateMachine +0x9af8      closure #1 in StateMachine.transition(_:)
15 TwilioStateMachine +0xc704      partial apply for closure #1 in StateMachine.transition(_:)
16 TwilioStateMachine +0xc720      partial apply for closure #2 in StateMachine.transition(_:)
17 libswiftDispatch.dylib +0x17f0  partial apply for thunk for @callee_guaranteed () -> (@out A, @error @owned Error)
...

We started seeing the second two crashes since upgrading from 2.x to 4.0.1.

berkus commented

Hey folks, this looks fairly serious, could you give more details about circumstances when these happen?

We're not able to reproduce it internally unfortunately with only stack traces to go by.
Tickets 12820748 and 12820789 have full stack traces attached.

berkus commented

Internal tickets: ref:4260, ref:4258, ref:4257

we are getting crash similar to this one on 4.0.2:

Crashed: com.twilio.twilsock.stateTransition
0  libsystem_kernel.dylib         0xa01c __pthread_kill + 8
1  libsystem_pthread.dylib        0x5680 pthread_kill + 268
2  libsystem_c.dylib              0x75b90 abort + 180
3  libswiftCore.dylib             0x3a24d8 swift::fatalError(unsigned int, char const*, ...) + 126
4  libswiftCore.dylib             0x3a24f8 swift::warningv(unsigned int, char const*, char*) + 30
5  libswiftCore.dylib             0x3a6ef8 swift_deallocPartialClassInstance + 306
6  libswiftCore.dylib             0x3a6d88 _swift_release_dealloc + 56
7  libswiftCore.dylib             0x3a8424 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1> >::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 136
8  libswiftCore.dylib             0x37fddc assignWithCopy for ClosedRange<>.Index + 208
9  TwilioTwilsockLib              0x1be88 outlined assign with copy of TwilsockTransportProtocol? + 56 (<compiler-generated>:56)
10 TwilioTwilsockLib              0x13e2c Twilsock.shutdownTransport() + 356 (Twilsock.swift:356)
11 TwilioTwilsockLib              0x10d8c closure #1 in closure #5 in Twilsock.init(certificates:authStruct:clientMetadata:notificationProductId:continuationTokenStorage:reachabilityMonitor:transportConfig:transportType:) + 158 (Twilsock.swift:158)
12 TwilioTwilsockLib              0x1027c closure #5 in Twilsock.init(certificates:authStruct:clientMetadata:notificationProductId:continuationTokenStorage:reachabilityMonitor:transportConfig:transportType:) + 137 (Twilsock.swift:137)
13 TwilioStateMachine             0xa22c StateMachine.notify(_:) + 167 (StateMachine.swift:167)
14 TwilioStateMachine             0x9afc closure #1 in StateMachine.transition(_:) + 153 (StateMachine.swift:153)
15 TwilioStateMachine             0xc708 partial apply for closure #1 in StateMachine.transition(_:) + 40 (<compiler-generated>:40)
16 TwilioStateMachine             0xc724 partial apply for closure #2 in StateMachine.transition(_:) + 156 (StateMachine.swift:156)
17 libswiftDispatch.dylib         0x1594 partial apply for thunk for @callee_guaranteed () -> (@out A, @error @owned Error) + 28
18 libswiftDispatch.dylib         0x1570 thunk for @callee_guaranteed () -> (@out A, @error @owned Error)partial apply + 16
19 libswiftDispatch.dylib         0x14b0 closure #1 in closure #1 in OS_dispatch_queue._syncHelper<A>(fn:execute:rescue:) + 188
20 libswiftDispatch.dylib         0x13e8 partial apply for thunk for @callee_guaranteed () -> () + 28
21 libswiftDispatch.dylib         0x13c0 thunk for @escaping @callee_guaranteed () -> () + 28
22 libdispatch.dylib              0x4300 _dispatch_client_callout + 20
23 libdispatch.dylib              0x136b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56
24 libswiftDispatch.dylib         0x2078 implicit closure #2 in implicit closure #1 in OS_dispatch_queue.asyncAndWait<A>(execute:) + 192
25 libswiftDispatch.dylib         0x1fb0 partial apply for implicit closure #2 in implicit closure #1 in OS_dispatch_queue.sync<A>(execute:) + 76
26 libswiftDispatch.dylib         0x1e30 OS_dispatch_queue._syncHelper<A>(fn:execute:rescue:) + 396
27 libswiftDispatch.dylib         0x1c74 OS_dispatch_queue.asyncAndWait<A>(execute:) + 140
28 libswiftDispatch.dylib         0x1be0 OS_dispatch_queue.sync<A>(execute:) + 64
29 TwilioStateMachine             0x91dc StateMachine.transition(_:) + 156 (StateMachine.swift:156)
30 TwilioStateMachine             0xc9e0 dispatch thunk of StateMachine.transition(_:) + 20
31 TwilioTwilsockLib              0xf700 specialized StateMachine.safeTransition(_:) + 638 (Twilsock.swift:638)
32 TwilioTwilsockLib              0x1562c Twilsock.handle(replyMessage:) + 445 (Twilsock.swift:445)
33 TwilioTwilsockLib              0x18d18 closure #1 in Twilsock.handleMessageReceived(_:) + 581 (Twilsock.swift:581)
34 TwilioTwilsockLib              0x6710 thunk for @escaping @callee_guaranteed () -> () + 28 (<compiler-generated>:28)
35 libdispatch.dylib              0x26a8 _dispatch_call_block_and_release + 32
36 libdispatch.dylib              0x4300 _dispatch_client_callout + 20
37 libdispatch.dylib              0x15dbc _dispatch_root_queue_drain + 864
38 libdispatch.dylib              0x163ec _dispatch_worker_thread2 + 156
39 libsystem_pthread.dylib        0x1928 _pthread_wqthread + 228
40 libsystem_pthread.dylib        0x1a04 start_wqthread + 8

might help

berkus commented

@MaximBazarov hi, can you please test 4.0.3 and validate if you see this crash gone?

@MaximBazarov hi, can you please test 4.0.3 and validate if you see this crash gone?

hey thank you for rapid reaction, we won't release this year, but in Jan I'll post here if we have it fixed

We're also seeing this latest issue and some of the initial ones too with version 4.0.2. We can't reproduce internally, which makes it hard to validate whether new versions work. Will update to 4.0.3 to see, but we also won't be able to confirm until next year.

We'll be adopting this update some time in the near future.

berkus commented

@MaximBazarov @MattSHallatt @brian-voong friendly poke, folks! If you have tried 4.0.3 please do tell how it goes.

Hey @berkus - glad to report that our crashes have been resolved after updating to 4.0.3 - thanks!

thank you for the poke @berkus I will get back to you shortly after our release on a new version.

Yes the crashes have since disappeared after our latest upgrade of this sdk.

same, no crashes any more

Excellent, do you folks get any notifications about the Privacy Manifest #58 with the Convo SDK nowadays?