aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
454 stars 196 forks source link

Crash in AppSyncRealTimeClient.unsubscribe(id:) #3835

Closed amruth-movano closed 1 month ago

amruth-movano commented 2 months ago

Describe the bug

Prod users are facing crash in -

          Crashed: com.apple.root.user-initiated-qos.cooperative
0  Evie Ring                      0x1451db4 AppSyncRealTimeClient.unsubscribe(id:) + 208 (AppSyncRealTimeClient.swift:208)
1  libswift_Concurrency.dylib     0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
2  libswift_Concurrency.dylib     0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
3  libdispatch.dylib              0x15894 _dispatch_root_queue_drain + 392
4  libdispatch.dylib              0x1609c _dispatch_worker_thread2 + 156
5  libsystem_pthread.dylib        0x48f8 _pthread_wqthread + 228
6  libsystem_pthread.dylib        0x10cc start_wqthread + 8

Steps To Reproduce

Expected behavior

App should not crash

Amplify Framework Version

2.33.6

Amplify Categories

API, Auth

Dependency manager

Swift PM

Swift version

5.9.2

CLI version

12.11.1

Xcode version

15.0

Relevant log output

-

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

amruth-movano commented 2 months ago

@5d @lawmicha Can you please check this on priority

harsh62 commented 2 months ago

Similar to what I mentioned in #3834 , would you be able to share more details around how we will be able to reproduce this crash in a local environment with symbolicated logs and verbose logs.

amruth-movano commented 2 months ago

@harsh62 We are unable to reproduce this scenario using Xcode and the only stack trace which we have is I have already added

lawmicha commented 2 months ago

Hi @amruth-movano, can you try with the latest to reproduce and provide us with a full stack trace? see @5d's comment over here https://github.com/aws-amplify/amplify-swift/issues/3834/#issuecomment-2318322611

5d commented 2 months ago

Hi @amruth-movano,

I've tried to subscribe/unsubscribe with 90 subscriptions several times to reproduce the issue. Unfortunately, I couldn't reproduce the issue.

var subscriptions = AtomicDictionary<String, Cancellable>()
Task {
    for _ in 1...30 {
        Task.detached {
            subscriptions.set(
                value: Amplify.API.subscribe(request: .subscription(to: Todo.self, subscriptionType: .onCreate)),
                forKey: UUID().uuidString
            )
        }

        Task.detached {
            subscriptions.set(
                value: Amplify.API.subscribe(request: .subscription(to: Todo.self, subscriptionType: .onUpdate)),
                forKey: UUID().uuidString
            )
        }

        Task.detached {
            subscriptions.set(
                value: Amplify.API.subscribe(request: .subscription(to: Todo.self, subscriptionType: .onDelete)),
                forKey: UUID().uuidString
            )
        }

    }
}

Would it be convenient for you to provide the complete crash symbol log from your side? Or if you have some confidential info inside the log, you can reach out to us with AWS support ticket.

github-actions[bot] commented 1 month ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.