Crash on AppSyncRealTimeClient.monitorHeartBeats(_:) + 428
Describe the bug
Our production users are getting crash in AppSyncRealTimeClient.monitorHeartBeats(_:) + 428 Below is the crash log
Crashed: com.apple.root.default-qos
0 libswiftCore.dylib 0x4065b4 swift_isUniquelyReferenced_nonNull_native + 38
1 Combine 0x23d70 AnyCancellable.store(in:) + 48
2 Evie Ring 0x13e4024 closure #1 in AppSyncRealTimeClient.monitorHeartBeats(_:) + 428 (AppSyncRealTimeClient.swift:428)
3 Evie Ring 0x13e5998 partial apply for thunk for @escaping @callee_guaranteed () -> () + 4355873176 (<compiler-generated>:4355873176)
4 Combine 0xaecc Subscribers.Sink.receive(_:) + 92
5 Combine 0xae60 protocol witness for Subscriber.receive(_:) in conformance Subscribers.Sink<A, B> + 24
6 Combine 0x3322c ReduceProducer.receive(_:) + 2312
7 Combine 0x1a304 protocol witness for Subscriber.receive(_:) in conformance ReduceProducer<A, B, C, D, E> + 24
8 Combine 0x651bc closure #1 in Publishers.Debounce.Inner.receive(_:) + 2780
9 libswiftDispatch.dylib 0x2c84 thunk for @escaping @callee_guaranteed () -> () + 36
10 libdispatch.dylib 0x3dd4 _dispatch_client_callout + 20
11 libdispatch.dylib 0x72d8 _dispatch_continuation_pop + 600
12 libdispatch.dylib 0x1b1c8 _dispatch_source_latch_and_call + 420
13 libdispatch.dylib 0x19d8c _dispatch_source_invoke + 832
14 libdispatch.dylib 0x15894 _dispatch_root_queue_drain + 392
15 libdispatch.dylib 0x1609c _dispatch_worker_thread2 + 156
16 libsystem_pthread.dylib 0x48f8 _pthread_wqthread + 228
17 libsystem_pthread.dylib 0x10cc start_wqthread + 8
Steps To Reproduce
-
Expected behavior
It should not crash
Amplify Framework Version
2.33.6
Amplify Categories
API, DataStore
Dependency manager
Swift PM
Swift version
5.9.2
CLI version
12.11.1
Xcode version
15.0
Relevant log output
No response
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
iOS 17.5.1
Device
iPhone 13 :Pro
Specific to simulators
No response
Additional context
No response
Hello, Thank you for posting this.
- Could you please post reproduction steps and the verbose logs for the issue with sensitive info redacted?
- We have shipped a number of fixes in Datastore and API category since the version being used in this (2.33.6). Could you please update the version to latest (2.35.3)?
It is not reproducible but there are almost more than 50 crash in same file for our production users
@thisisabhash Please see attached crash log & screenshot. Lot of crashes are there -
com.movano.ios_issue_1c32bbe4b45e1a0fbe6d5e50a6792814_crash_session_d1e749f300c94a3db155f407d5223920_DNE_2_v2_stacktrace.txt com.movano.ios_issue_a4e6e5d36347918d537b083747434171_crash_session_93b25e65de234b92b329c4d092568a8f_DNE_8_v2_stacktrace.txt com.movano.ios_issue_c73b3f2867e1ff4d636ba86bbf9825c8_crash_session_0ac07fcd31794891bbf97cb7d22444bd_DNE_8_v2_stacktrace.txt
@amruth-movano Thank you for providing the crash reports. I'll investigate to see if I can reproduce the issue.
@5d Did you get any hint in this, as many users are seeing this crash?
@amruth-movano Our team is still trying to reproduce this issue in our local environment. You said its not reproducible, but are you able to deduce from the usage of Amplify on what are the most likely possible steps?
@harsh62 Did we get any solution on this? I am attaching 2 more crash stack traces com.movano.ios_issue_a4e6e5d36347918d537b083747434171_crash_session_367dbdf4562f47f2b186c7537fb30bcb_DNE_8_v2_stacktrace.txt com.movano.ios_issue_1c32bbe4b45e1a0fbe6d5e50a6792814_crash_session_9af4735f876947d9a4f2ee45afc46228_DNE_8_v2_stacktrace.txt
Thank you for your patience - we will investigate and post updates.
Hi @amruth-movano ,
Unfortunately, I couldn't reproduce the issue.
Based on the stack traces, one potential cause could be that the actor-guarded property cancellables is not running in an isolated context with Apple's AnyCancellable.store(in:). I've made a potential fix on the branch 5d/fix-3748. I will discuss this with the team to see if this could mitigate the issue.
Hi @5d,
I am also facing this issue on version 2.29.1. There are lots of Crashes due to this. What measures can I take to prevent this? I have looked over the release notes of all the recent Amplify Versions, but none of them mentioned this issue being fixed.
Hi @minaamaw-sl, were you able to try out the 5d/fix-3748 branch in your app to resolve the issue?
@lawmicha, I have not tried it as I am unable to reproduce it, however Analytics show that it does Crash for some users.
@minaamaw-sl Our team will review the attached PR and provide an update once it gets merged.
@harsh62 @lawmicha @5d @thisisabhash Could you let me know if the solution has yet been released to users? We have lots of users facing this?
Possibly related: #3834 , #3835
@harsh62 Thanks for checking. Can you let us know when are we going to release it in new version?
https://github.com/aws-amplify/amplify-swift/pull/3824 has been released in 2.39.0. Please let us know if you are still seeing the crash after upgrading to that version.
Hi,
i am still getting this crash after updating the library to 2.39.0
Hi @tenaz92 ,
Could you please share the complete crash log? I see that you're using version 2.39.0. However, based on the screeshot, AppSyncRealTimeClient.swift#L428 in version 2.39.0 doesn't seem to be associated with the monitorHeartBeats function.
Confirming I am also still having the same issue. It appears to happen when the app has been left open for a while on a user's device.
Hi @zachfields , We appreciate your confirmation. Our team will attempt to replicate the issue. To assist us further, would you be able to provide the symbolicated crash logs for the most recent crash that occurred after updating to version 2.39.0?
Hi @zachfields , We appreciate your confirmation. Our team will attempt to replicate the issue. To assist us further, would you be able to provide the symbolicated crash logs for the most recent crash that occurred after updating to version 2.39.0?
We see a very high occurrence of this crash in the application, please find the stack trace attached. We are on 2.35.4 version of amplify
This appears to have been resolved in an update over the last couple of months for me, thanks!
That's great to hear. @allab Have you tried updating as well?