microsoft-authentication-library-for-objc icon indicating copy to clipboard operation
microsoft-authentication-library-for-objc copied to clipboard

Occasional crashes in [MSIDLocalInteractiveController acquireToken:]

Open artemisia-absynthium opened this issue 3 years ago • 8 comments

Hello,

I found on Crashlytics some occasional crashes (they are affecting a really small percentage of users) with this crashlog:

Crashed: com.apple.main-thread
0  MSAL                           0x1033de628 __47-[MSIDLocalInteractiveController acquireToken:]_block_invoke + 448
1  MSAL                           0x1033df480 __74-[MSIDLocalInteractiveController acquireTokenWithRequest:completionBlock:]_block_invoke + 260
2  MSAL                           0x103372338 __60-[MSIDInteractiveTokenRequest executeRequestWithCompletion:]_block_invoke + 104
3  MSAL                           0x10335b338 __73-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:]_block_invoke_2 + 276
4  MSAL                           0x10335adb0 __73-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:]_block_invoke + 172
5  MSAL                           0x1033e1d90 __67+[MSIDWebviewAuthorization startSession:context:completionHandler:]_block_invoke + 120
6  MSAL                           0x1033bbd70 __58-[MSIDSystemWebviewController startWithCompletionHandler:]_block_invoke + 336
7  MSAL                           0x1033d348c __68-[MSIDASWebAuthenticationSessionHandler startWithCompletionHandler:]_block_invoke + 308
8  AuthenticationServices         0x1cbb7f8b8 -[ASWebAuthenticationSession _startDryRun:] + 696
9  MSAL                           0x1033d3284 -[MSIDASWebAuthenticationSessionHandler startWithCompletionHandler:] + 456
10 MSAL                           0x1033bba60 -[MSIDSystemWebviewController startWithCompletionHandler:] + 756
11 MSAL                           0x1033e1b38 +[MSIDWebviewAuthorization startSession:context:completionHandler:] + 248
12 libdispatch.dylib              0x19b99f2b0 _dispatch_call_block_and_release + 24
13 libdispatch.dylib              0x19b9a0298 _dispatch_client_callout + 16
14 libdispatch.dylib              0x19b982430 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 872
15 CoreFoundation                 0x19bce72e0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
16 CoreFoundation                 0x19bce1740 __CFRunLoopRun + 2528
17 CoreFoundation                 0x19bce0818 CFRunLoopRunSpecific + 572
18 GraphicsServices               0x1b23e6570 GSEventRunModal + 160
19 UIKitCore                      0x19e60c0e8 -[UIApplication _run] + 1052
20 UIKitCore                      0x19e611664 UIApplicationMain + 164
21 libswiftUIKit.dylib            0x1aedff87c UIApplicationMain(_:_:_:_:) + 100
22 <MyApp>                        0x1029835d0 main + 4375131600 (UIFont+Extension.swift:4375131600)
23 libdyld.dylib                  0x19b9bf140 start + 4

There is no other info about the crash in the Crashlytics dashboard.

The devices where the crash is occuring are

  • iPhone 8 Plus, iOS 14.6.0 (18F72)
  • iPhone 8, iOS 14.4.2 (18D70)
  • iPhone 8 Plus, iOS 14.5.1 (18E212)

I know it's not a lot of information, so please let me know if you need any further detail, if I can have it I'll attach it.

Have a nice day!

artemisia-absynthium avatar Aug 27 '21 09:08 artemisia-absynthium

Hi @artemisia-absynthium , if you can get us MSAL logs we can take a further look into why the crash happened.

ameyapat avatar Sep 09 '21 22:09 ameyapat

Hi @ameyapat, unfortunately that's all I have on my Crashlytics dashboard, the crash didn't happen on any of my devices, neither I can reproduce it. I will record MSAL logs on Crashlytics for the future.

artemisia-absynthium avatar Sep 15 '21 07:09 artemisia-absynthium

Hi @ameyapat, which log level would you need at least? I would like to go with warning to avoid slowing down the app, but please tell me if you need no less than info.

artemisia-absynthium avatar Sep 21 '21 07:09 artemisia-absynthium

@artemisia-absynthium , Sure let's start with the log level at warning

Veena11 avatar Sep 23 '21 22:09 Veena11

This issue has been automatically marked as stale because it has not had recent activity. Please provide additional information if requested. Thank you for your contributions.

stale[bot] avatar Oct 11 '21 05:10 stale[bot]

Awaiting new log. Feel free to send the log directly to our dev mailbox: [email protected] and we will follow-up. Thanks

hieunguyenmsft avatar Oct 12 '21 17:10 hieunguyenmsft

Hi @hieunguyenmsft , I've had another occurrence where I've been able to gather MSAL logs and I forwarded everything to the email address you provided but it was bounced with an error saying "The group identity-apple-eng only accepts messages from people in its organization or on its allowed senders list, and your email address isn't on the list.".

I'm reattaching the files here, MSAL version is 1.1.22.

MSALCrash.zip

Thank you very much!

artemisia-absynthium avatar Nov 29 '21 10:11 artemisia-absynthium

Hello, @artemisia-absynthium. Sorry about the issue, I didn't know the alias only for internal... I see your log, will keep you posted what I found. Thank you.

hieunguyenmsft avatar Nov 29 '21 17:11 hieunguyenmsft

@hieunguyenmsft We start getting the very same crash too; is there any fix/workaround known? Will it be addressed in the next MSAL version?

lucac-apps avatar Dec 13 '22 09:12 lucac-apps

@lucac-apps I couldn't find the root cause from @artemisia-absynthium log. Can you help by collecting logs and send to [email protected]. Thank you. Any context to repro the issue would be helpful, I will try to repro in my local.

hieunguyenmsft avatar Dec 13 '22 20:12 hieunguyenmsft

@lucac-apps I couldn't find the root cause from @artemisia-absynthium log. Can you help by collecting logs and send to [email protected]. Thank you. Any context to repro the issue would be helpful, I will try to repro in my local.

As soon we manage to replicate it on our test devices I send them to you with the context information.

lucac-apps avatar Dec 14 '22 08:12 lucac-apps

@hieunguyenmsft the same crash is being reported in my Firebase console, and I use MSAL iOS (1.2.3) with webviewType = .safariViewController (SFSafariViewController). This issue was closed as completed, is there a fix or workaround? What version of the MSAL library has the fix

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010
0  MSAL                           0x9dc04 __47-[MSIDLocalInteractiveController acquireToken:]_block_invoke + 93 (MSIDLocalInteractiveController.m:93)
1  MSAL                           0x9e9e0 __74-[MSIDLocalInteractiveController acquireTokenWithRequest:completionBlock:]_block_invoke + 213 (MSIDLocalInteractiveController.m:213)
2  MSAL                           0x8316c __60-[MSIDInteractiveTokenRequest executeRequestWithCompletion:]_block_invoke + 94 (MSIDInteractiveTokenRequest.m:94)
3  MSAL                           0x82540 __73-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:]_block_invoke_2 + 123 (MSIDInteractiveAuthorizationCodeRequest.m:123)
4  MSAL                           0x81fcc __73-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:]_block_invoke + 127 (MSIDInteractiveAuthorizationCodeRequest.m:127)
5  MSAL                           0xd36a8 __67+[MSIDWebviewAuthorization startSession:context:completionHandler:]_block_invoke + 91 (MSIDWebviewAuthorization.m:91)
6  MSAL                           0xc3f24 __58-[MSIDSystemWebviewController startWithCompletionHandler:]_block_invoke + 143 (MSIDSystemWebviewController.m:143)
7  MSAL                           0xb5ddc -[MSIDSafariViewController completeSessionWithResponse:context:error:] + 124 (MSIDSafariViewController.m:124)
8  MSAL                           0xb5f80 -[MSIDSafariViewController safariViewControllerDidFinish:] + 150 (MSIDSafariViewController.m:150)
9  SafariServices                 0x104458 -[SFSafariViewController remoteViewControllerWillDismiss:] + 128
10 SafariServices                 0xd32e0 -[SFBrowserRemoteViewController willDismissServiceViewController] + 128
11 CoreFoundation                 0x21b24 __invoking___ + 148
12 CoreFoundation                 0x3f610 -[NSInvocation invoke] + 468
13 libdispatch.dylib              0x3a30 _dispatch_client_callout + 20
14 libdispatch.dylib              0x74e0 _dispatch_block_invoke_direct + 264
15 FrontBoardServices             0xbc70 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48
16 FrontBoardServices             0xb040 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220
17 FrontBoardServices             0xf700 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
18 CoreFoundation                 0xbb414 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
19 CoreFoundation                 0xcc1a0 __CFRunLoopDoSource0 + 208
20 CoreFoundation                 0x5694 __CFRunLoopDoSources0 + 268
21 CoreFoundation                 0xb05c __CFRunLoopRun + 828
22 CoreFoundation                 0x1ebc8 CFRunLoopRunSpecific + 600
23 GraphicsServices               0x1374 GSEventRunModal + 164
24 UIKitCore                      0x514b58 -[UIApplication _run] + 1100
25 UIKitCore                      0x296090 UIApplicationMain + 364
26 mycoolapp                      0x1aec48 main + 22 (AppDelegate.swift:22)
27 ???                            0x104de9da4 (Missing)

alexeystrakh avatar Feb 03 '23 00:02 alexeystrakh

@hieunguyenmsft This crash is still here, my team have experienced it multiple times recently with version 1.2.6. We are trying to acquire MSAL logs for deeper analisys.

Crashed: com.apple.main-thread
0  MSAL                           0x8a614 __47-[MSIDLocalInteractiveController acquireToken:]_block_invoke + 93 (MSIDLocalInteractiveController.m:93)
1  MSAL                           0x8b170 __74-[MSIDLocalInteractiveController acquireTokenWithRequest:completionBlock:]_block_invoke + 213 (MSIDLocalInteractiveController.m:213)
2  MSAL                           0x72d30 __60-[MSIDInteractiveTokenRequest executeRequestWithCompletion:]_block_invoke + 94 (MSIDInteractiveTokenRequest.m:94)
3  MSAL                           0x72258 __73-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:]_block_invoke_2 + 123 (MSIDInteractiveAuthorizationCodeRequest.m:123)
4  MSAL                           0x71de8 __73-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:]_block_invoke + 127 (MSIDInteractiveAuthorizationCodeRequest.m:127)
5  MSAL                           0xb87e0 +[MSIDWebviewAuthorization startSession:context:completionHandler:] + 81 (MSIDWebviewAuthorization.m:81)
6  MSAL                           0x90958 +[MSIDMainThreadUtil executeOnMainThreadIfNeeded:] + 36 (MSIDMainThreadUtil.m:36)
7  MSAL                           0xb84c4 +[MSIDWebviewAuthorization startSessionWithWebView:oauth2Factory:configuration:context:completionHandler:] + 59 (MSIDWebviewAuthorization.m:59)
8  MSAL                           0x723b4 -[MSIDInteractiveAuthorizationCodeRequest showWebComponentWithCompletion:] + 219 (MSIDInteractiveAuthorizationCodeRequest.m:219)
9  MSAL                           0x71d18 -[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletionImpl:] + 204 (MSIDInteractiveAuthorizationCodeRequest.m:204)
10 MSAL                           0x42b68 -[MSIDAuthority loadOpenIdMetadataWithContext:completionBlock:] + 225 (MSIDAuthority.m:225)
11 MSAL                           0x71bcc __69-[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletion:]_block_invoke + 92 (MSIDInteractiveAuthorizationCodeRequest.m:92)
12 MSAL                           0x42770 __78-[MSIDAuthority resolveAndValidate:userPrincipalName:context:completionBlock:]_block_invoke + 128 (MSIDAuthority.m:128)
13 MSAL                           0x277cc -[MSIDAadAuthorityResolver handleRecord:authority:completionBlock:] + 179 (MSIDAadAuthorityResolver.m:179)
14 MSAL                           0x26dcc -[MSIDAadAuthorityResolver resolveAuthority:userPrincipalName:validate:context:completionBlock:] + 75 (MSIDAadAuthorityResolver.m:75)
15 MSAL                           0x4257c -[MSIDAuthority resolveAndValidate:userPrincipalName:context:completionBlock:] + 111 (MSIDAuthority.m:111)
16 MSAL                           0x71ab0 -[MSIDInteractiveAuthorizationCodeRequest getAuthCodeWithCompletion:] + 80 (MSIDInteractiveAuthorizationCodeRequest.m:80)
17 MSAL                           0x72c74 -[MSIDInteractiveTokenRequest executeRequestWithCompletion:] + 96 (MSIDInteractiveTokenRequest.m:96)
18 MSAL                           0x8afe0 -[MSIDLocalInteractiveController acquireTokenWithRequest:completionBlock:] + 214 (MSIDLocalInteractiveController.m:214)
19 MSAL                           0x8a418 -[MSIDLocalInteractiveController acquireToken:] + 97 (MSIDLocalInteractiveController.m:97)
20 MSAL                           0x49788 -[MSIDBrokerInteractiveController handleFailedOpenURL:] + 499 (MSIDBrokerInteractiveController.m:499)
21 libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
22 libdispatch.dylib              0x3eac _dispatch_client_callout + 20
23 libdispatch.dylib              0x126a4 _dispatch_main_queue_drain + 928
24 libdispatch.dylib              0x122f4 _dispatch_main_queue_callback_4CF + 44
25 CoreFoundation                 0x98c28 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
26 CoreFoundation                 0x7a560 __CFRunLoopRun + 1992
27 CoreFoundation                 0x7f3ec CFRunLoopRunSpecific + 612
28 GraphicsServices               0x135c GSEventRunModal + 164
29 UIKitCore                      0x39d6e8 -[UIApplication _run] + 888
30 UIKitCore                      0x39d34c UIApplicationMain + 340
31 ePanorama                      0x6100 main + 14 (main.swift:14)
32 ???                            0x1c12b6dec (Missing)
```

mrakko avatar Jul 04 '23 12:07 mrakko