aws-sdk-ios icon indicating copy to clipboard operation
aws-sdk-ios copied to clipboard

App crash on following code

Open JyotsnaPiOSDEV opened this issue 3 years ago • 2 comments

public func signOut() { self.credentialsFetchCancellationSource.cancel() if federationProvider == .hostedUI { AWSCognitoAuth.init(forKey: AWSMobileClientConstants.CognitoAuthRegistrationKey).signOutLocallyAndClearLastKnownUser() } self.cachedLoginsMap = [:] self.customRoleArnInternal = nil self.setCustomRoleArnInternal(nil, for: self) self.saveLoginsMapInKeychain() self.setLoginProviderMetadataAndSaveInKeychain(provider: .none) self.performUserPoolSignOut() self.internalCredentialsProvider?.identityProvider.identityId = nil self.internalCredentialsProvider?.clearKeychain() self.mobileClientStatusChanged(userState: .signedOut, additionalInfo: [:]) self.federationProvider = .none self.credentialsFetchCancellationSource = AWSCancellationTokenSource() self.clearHostedUIOptionsScopesFromKeychain() } app crash at line

    self.credentialsFetchCancellationSource = AWSCancellationTokenSource()

SDK Version: 2.270. Dependency Manager: Cocoapods

Device: Any device iOS Version: Any version

JyotsnaPiOSDEV avatar Aug 08 '22 07:08 JyotsnaPiOSDEV

HI @JyotsnaPiOSDEV , thanks for opening this issue. Can you also provide the crash exception stacktrace?

phantumcode avatar Aug 08 '22 19:08 phantumcode

signedOut -> error(AWSMobileClient.FetchUserPoolTokensOperation.TokenFetchError.noUserFound)
anager.swift:450 (Votion Home:x86_64+0x1001d0a96)
    #4 closure #1 in AWSSubscribeTopicModel.SetupStatusCallback(err:region:) AWSSubscribeTopicModel.swift:477 (Votion Home:x86_64+0x1009e170c)
    #5 partial apply for closure #1 in AWSSubscribeTopicModel.SetupStatusCallback(err:region:) <compiler-generated> (Votion Home:x86_64+0x1009feb34)
    #6 AWSMobileClient.getTokens(_:) AWSMobileClient+Tokens.swift:59 (AWSMobileClient:x86_64+0x94c7e)
    #7 AWSSubscribeTopicModel.SetupStatusCallback(err:region:) AWSSubscribeTopicModel.swift:473 (Votion Home:x86_64+0x1009e0e64)
    #8 mqttEventCallbackWebsocket #1 (_:) in AWSSubscribeTopicModel.connectAWSViaWebsocket(region:completionHandle2022-08-16 13:30:41:399 Votion Home[1994:171500] 78DE01E5-1321-4086-9AD7-A1748109CBE3 notStarted: signedOut -> notStarted
r:) AWSSubscribeTopicModel.swift:540 (Votion Home:x86_64+0x1009e41fc)
    #9 partial apply for mqttEventCallbackWebsocket #1 (_:) in AWSSubscribeTopicModel.connectAWSViaWebsocket(region:completionHandler:) <compiler-generated> (Votion Home:x86_64+0x1009ffd47)
    #10 thunk for @escaping @callee_guaranteed (@unowned AWSIoTMQTTStatus) -> () <compiler-generated> (Votion Home:x86_64+0x10052b47b)
    #11 __42-[AWSIoTMQTTClient notifyConnectionStatus]_block_invoke AWSIoTMQTTClient.m:705 (AWSIoT:x86_64+0x172295)
    #12 __tsan::invoke_and_release_block(void*) <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x7070b)
    #13 _dispatch_client_callout <null>:2 (libdispatch.dylib:x86_64+0x474d)

  Location is heap block of size 336 at 0x7b4800004b00 allocated by main thread:
    #0 calloc <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x4e852)
    #1 _objc_rootAllocWithZone <null>:2 (li2022-08-16 13:30:41:401 Votion Home[1994:170746] WebSocket closed with code:0 with reason:(null)
bobjc.A.dylib:x86_64+0x16769)
    #2 one-time initialization function for _sharedInstance AWSMobileClient.swift:21 (AWSMobileClient:x86_64+0x46a2c)
    #3 dispatch_once <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x71404)
    #4 dispatch_once_f <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x714f0)
    #5 swift_once <null>:2 (libswiftCore.dylib:x86_64+0x353599)
    #6 static AWSMobileClient.default() AWSMobileClient.swift:123 (AWSMobileClient:x86_64+0x4d5f5)
    #7 AWSAuthManager.initialize() AWSAuthManager.swift:38 (Votion Home:x86_64+0x1001bbe76)
    #8 AppDelegate.application(_:didFinishLaunchingWithOptions:) AppDelegate.swift:41 (Votion Home:x86_64+0x100442102)
    #9 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) <compiler-generated> (Votion Home:x86_64+0x1004424b8)
    #10 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] <null>:2 (UIKitCore:x2022-08-16 13:30:41:419 Votion Home[1994:171592] 430A2E72-A004-4337-8F24-EB69E931C948 notStarted: signedOut -> notStarted
86_64+0xbfb6f0)
    #11 start <null>:2 (libdyld.dylib:x86_64+0xbbc)

  Mutex M934474 (0x7b1800901210) created at:
    #0 pthread_mutex_init <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x2ba13)
    #1 -[NSLock init] <null>:2 (Foundation:x86_64+0xbcaf6)
    #2 NSLock.__allocating_init() <compiler-generated> (Votion Home:x86_64+0x1009e6f5f)
    #3 AWSSubscribeTopicModel.connectDeviceToAWS() AWSSubscribeTopicModel.swift:604 (Votion Home:x86_64+0x1009e60a3)
    #4 closure #1 in AWSSubscribeTopicModel.getAWSCredentials() AWSSubscribeTopicModel.swift:497 (Votion Home:x86_64+0x1009e2903)
    #5 partial apply for closure #1 in AWSSubscribeTopicModel.getAWSCredentials() <compiler-generated> (Votion Home:x86_64+0x1009febe4)
    #6 closure #1 in closure #1 in AWSMobileClient.getAWSCredentials(_:) AWSMobileClient+Credentials.swift:68 (AWSMobileClient:x86_64+0x6cf09)
    #7 partial apply for 2022-08-16 13:30:41:461 Votion Home[1994:171588] 7002411D-FB46-4265-9528-611617AFF652 error(AWSMobileClient.FetchUserPoolTokensOperation.TokenFetchError.noUserFound): signedOut -> error(AWSMobileClient.FetchUserPoolTokensOperation.TokenFetchError.noUserFound)
closure #1 in closure #1 in AWSMobileClient.getAWSCredentials(_:) <compiler-generated> (AWSMobileClient:x86_64+0x6d0ee)
user signed out
Error getting token The operation couldn’t be completed. (AWSMobileClient.AWSMobileClientError error 26.)
    #8 thunk for @escaping @callee_guaranteed (@guaranteed AWSTask<AWSCredentials>) -> (@out Any?) <compiler-generated> (AWSMobileClient:x86_64+0x6d35e)
    #9 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke AWSTask.m:331 (AWSCore:x86_64+0x158185)
    #10 __30+[AWSExecutor defaultExecutor]_block_invoke_2 AWSExecutor.m:65 (AWSCore:x86_64+0x95109)
    #11 -[AWSExecutor execute:] AWSExecutor.m:131 (AWSCore:x86_64+0x96445)
    #12 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke.104 AWSTask.m:363 (AWSCore:x86_64+0x158b67)
    #13 -[AWSTask runContinuations] AWSTask.m:307 (AWSCore:x86_64+0x157523)
    #14 -[AWSTask trySetResult:] AWSTask.m:247 (AWSCore:x86_64+0x1566ae)
    #15 -[AWSTaskCompletionSource setResult:] AWSTaskCompletionSource.m:45 (AWSCore:x86_64+0x15acb4)
    #16 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 AWSTask.m:340 (AWSCore:x86_64+0x1588e8)
    #17 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke AWSTask.m:348 (AWSCore:x86_64+0x15844d)
    #18 __30+[AWSExecutor defaultExecutor]_block_invoke_2 AWSExecutor.m:65 (AWSCore:x86_64+0x95109)
    #19 -[AWSExecutor execute:] AWSExecutor.m:131 (AWSCore:x86_64+0x96445)
2022-08-16 13:30:41:466 Votion Home[1994:171593] 78DE01E5-1321-4086-9AD7-A1748109CBE3 Start execution
    #20 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke.104 AWSTask.m:363 (AWSCore:x86_64+0x158b67)
    #21 -[AWSTask runContinuations] AWSTask.m:307 (AWSCore:x86_64+0x152022-08-16 13:30:41:466 Votion Home[1994:171498] closing encoder stream.
2022-08-16 13:30:41:467 Votion Home[1994:171498] closing decoder stream.
7523)
    #22 -[AWSTask trySetResult:] AWSTask.m:247 (AWSCore:x86_64+0x1566ae)
    #23 -[AWSTaskCompletionSource setResult:] AWSTaskCompletionSource.m:45 (AWSCore:x86_64+0x15acb4)
    #24 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 AWSTask.m:340 (AWSCore:x86_64+0x1588e8)
    #25 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke AWSTask.m:331 (AWSCore:x86_64+0x158185)
    #26 __30+[AWSExecutor defaultExecutor]_block_invoke_2 AWSExecutor.m:65 (AWSCore:x86_64+0x95109)
    #27 -[AWSExecutor execute:] AWSExecutor.m:131 (AWSCore:x86_64+0x96445)
    #28 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke.104 AWSTask.m:363 (AWSCore:x86_64+0x158b67)
    #29 -[AWSTask runContinuations] AWSTask.m:307 (AWSCore:x86_64+0x157523)
    #30 -[AWSTask trySetResult:] AWSTask.m:247 (AWSCore:x86_64+0x1566ae)
  2022-08-16 13:30:41:467 Votion Home[1994:171420] B8A54190-4F5C-4DFE-B30C-A060BB1D1B48 notStarted: signedOut -> notStarted
2022-08-16 13:30:41:468 Votion Home[1994:171119] 2051911A-ACBD-4DF3-8F11-6C62A3D7F701 notStarted: signedOut -> notStarted
2022-08-16 13:30:41:479 Votion Home[1994:171497] closing encoder stream.
2022-08-16 13:30:41:479 Votion Home[1994:171497] closing decoder stream.
2022-08-16 13:30:41:483 Votion Home[1994:171500] 78DE01E5-1321-4086-9AD7-A1748109CBE3 notStarted: signedOut -> notStarted
2022-08-16 13:30:41:486 Votion Home[1994:171592] 430A2E72-A004-4337-8F24-EB69E931C948 notStarted: signedOut -> notStarted
2022-08-16 13:30:41:488 Votion Home[1994:171588] 7002411D-FB46-4265-9528-611617AFF652 error(AWSMobileClient.FetchUserPoolTokensOperation.TokenFetchError.noUserFound): signedOut -> error(AWSMobileClient.FetchUserPoolTokensOperation.TokenFetchError.noUserFound)
  #31 -[AWSTaskCompletionSource setResult:] AWSTaskCompletionSource.m:45 (AWSCore:x86_64+0x15acb4)
2022-08-16 13:30:41:499 Votion Home[1994:171420] B8A54190-4F5C-4DFE-B30C-A060BB1D1B48 notStarted: signedOut -> notStarted
2022-08-16 13:30:41:501 Votion Home[1994:171119] 2051911A-ACBD-4DF3-8F11-6C62A3D7F701 notStarted: signedOut -> notStarted
    #32 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke_2 AWSTask.m:340 (AWSCore:x86_64+0x1588e8)
    #33 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke AWSTask.m:331 (AWSCore:x86_64+0x158185)
    #34 __30+[AWSExecutor defaultExecutor]_block_invoke_2 AWSExecutor.m:65 (AWSCore:x86_64+0x95109)
    #35 -[AWSExecutor execute:] AWSExecutor.m:131 (AWSCore:x86_64+0x96445)
2022-08-16 13:30:41:502 Votion Home[1994:171500] 78DE01E5-1321-4086-9AD7-A1748109CBE3 notStarted: signedOut -> notStarted
2022-08-16 13:30:41:503 Votion Home[1994:171592] 430A2E72-A004-4337-8F24-EB69E931C948 notStarted: signedOut -> notStarted

JyotsnaPiOSDEV avatar Aug 16 '22 08:08 JyotsnaPiOSDEV

The above stack trace does not point to any location in signOut. Are you sure this is the right crash report? I also do not see any thread marked as crash in the report.

Can you provide the right crash logs please. Also if you can provide us the steps to reproduce this issue we will try to replicate it from our side.

royjit avatar Sep 23 '22 20:09 royjit

Closing due to inactivity

royjit avatar Oct 24 '22 17:10 royjit