Skip to content

Issue with Dynamic Links with Xcode 13 #8655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
crleonard opened this issue Sep 14, 2021 · 31 comments · Fixed by #8847
Closed

Issue with Dynamic Links with Xcode 13 #8655

crleonard opened this issue Sep 14, 2021 · 31 comments · Fixed by #8847

Comments

@crleonard
Copy link

There seems to be an issue with FirebaseDynamicLinks when running on Xcode 13.

Call FirebaseApp.configure() from app delegate, when /FIRDLJavaScriptExecutor.m is hit, the line [_wkWebView loadHTMLString:htmlContent baseURL:nil]; causes a crash with the result of Thread 1: EXC_BAD_ACCESS (code=1, address=0x10).

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@ryanwilson
Copy link
Member

Hey @crleonard, sorry for the troubles. It looks like this is similar to #7618 - can you please share which version of Firebase you're using, update to the latest if you're not on it, and let us know if it's resolved?

@google-oss-bot
Copy link

Hey @crleonard. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@lammertw
Copy link

lammertw commented Sep 24, 2021

I'm running into the same issue. Version 8.7.0
Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)

Running with Xcode 13 on iOS 15 simulator on Intel Mac.

Stacktrace:

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x00007fff20195d24 in class_createInstance ()
#1	0x00007fff20111182 in 0x7fff20111182 ()
#2	0x00007fff20116eb1 in 0x7fff20116eb1 ()
#3	0x00007fff2657649d in 0x7fff2657649d ()
#4	0x00007fff20111a56 in 0x7fff20111a56 ()
#5	0x00007fff20112ca5 in 0x7fff20112ca5 ()
#6	0x00007fff2658fa96 in 0x7fff2658fa96 ()
#7	0x00007fff2658fddb in 0x7fff2658fddb ()
#8	0x00007fff2658f3e4 in 0x7fff2658f3e4 ()
#9	0x00007fff20111a56 in 0x7fff20111a56 ()
#10	0x00007fff20112ca5 in 0x7fff20112ca5 ()
#11	0x00007fff2658f3be in 0x7fff2658f3be ()
#12	0x00007fff35daa897 in +[NEFilterSource filterRequired] ()
#13	0x00007fff298138ea in WebKit::WebPageProxy::createNetworkExtensionsSandboxExtensions(WebKit::WebProcessProxy&) ()
#14	0x00007fff29813705 in WebKit::WebPageProxy::addPlatformLoadParameters(WebKit::WebProcessProxy&, WebKit::LoadParameters&) ()
#15	0x00007fff298b1ef1 in WebKit::WebPageProxy::loadDataWithNavigationShared(WTF::Ref<WebKit::WebProcessProxy, WTF::RawPtrTraits<WebKit::WebProcessProxy> >&&, WTF::ObjectIdentifier<WebCore::PageIdentifierType>, API::Navigation&, IPC::ArrayReference<unsigned char, 18446744073709551615ul> const&, WTF::String const&, WTF::String const&, WTF::String const&, API::Object*, WebCore::ShouldTreatAsContinuingLoad, std::__1::optional<WebKit::NavigatingToAppBoundDomain>, std::__1::optional<WebKit::WebsitePoliciesData>&&, WebCore::ShouldOpenExternalURLsPolicy, WebCore::SubstituteData::SessionHistoryVisibility) ()
#16	0x00007fff298b1abd in WebKit::WebPageProxy::loadData(IPC::ArrayReference<unsigned char, 18446744073709551615ul> const&, WTF::String const&, WTF::String const&, WTF::String const&, API::Object*, WebCore::ShouldOpenExternalURLsPolicy) ()
#17	0x00007fff29771efb in -[WKWebView loadData:MIMEType:characterEncodingName:baseURL:] ()
#18	0x0000000108e5f584 in -[FIRDLJavaScriptExecutor start] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecutor.m:96
#19	0x0000000108e5f3e8 in -[FIRDLJavaScriptExecutor initWithDelegate:script:] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecutor.m:71
#20	0x0000000108e5ecf9 in -[FIRDLDefaultRetrievalProcessV2 fetchLocaleFromWebView] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.m:252
#21	0x0000000108e5dd46 in -[FIRDLDefaultRetrievalProcessV2 retrievePendingDynamicLink] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.m:80
#22	0x0000000108e65c1d in -[FIRDynamicLinks checkForPendingDynamicLink] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m:311
#23	0x0000000108e64d48 in __39+[FIRDynamicLinks componentsToRegister]_block_invoke at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m:135
#24	0x0000000108e28f0a in -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRComponentContainer.m:148
#25	0x0000000108e291c0 in -[FIRComponentContainer instanceForProtocol:] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRComponentContainer.m:182
#26	0x0000000108e28d42 in -[FIRComponentContainer instantiateEagerComponents] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRComponentContainer.m:125
#27	0x0000000108e238e1 in +[FIRApp configureWithName:options:] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRApp.m:212
#28	0x0000000108e232da in +[FIRApp configureWithOptions:] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRApp.m:151
#29	0x0000000108e2323e in +[FIRApp configure] at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRApp.m:137
#30	0x00000001085f0288 in static SharedApp.initialize() at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Eneco/Eneco/SharedApp.swift:67
#31	0x00000001085fcad2 in AppDelegate.init() at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Eneco/Eneco/AppDelegate.swift:48
#32	0x00000001085fcdcf in @objc AppDelegate.init() ()
#33	0x00007fff250010af in _UIApplicationMainPreparations ()
#34	0x00007fff25000a37 in UIApplicationMain ()
#35	0x0000000108601d2f in main at /Users/lwesterhoff/Developer/Eneco/eneco-app/ios/Eneco/Eneco/AppDelegate.swift:42
#36	0x00000001088b6e1e in start_sim ()

@morganchen12
Copy link
Contributor

@lammertw can you try reproing the crash with some memory debugging tools enabled (and also fully symbolicate the crash log)? It's not normal for WebKit to crash in class_createInstance.

@lammertw
Copy link

@morganchen12 I have no idea why but after switching some branches, turning on and off memory debugging tools and then running it without, now it's no longer crashing (without any actual changes in my git repo). So if the problem does return I'll let you know.

@crleonard
Copy link
Author

I'm still having the same issue. Do you have any updates?

@crleonard
Copy link
Author

Also tried 8.8.0 (was 8.7.0)

@crleonard
Copy link
Author

This device isnt an M1 Mac

@ryanwilson
Copy link
Member

@crleonard can you please share more info from the issue template to help us debug? Right now we don't have enough information to reproduce this. Specifically:

  • iOS version you're seeing the issue
  • Full stack trace of the crash, including the non crashed thread

Does this reproduce 100% of the time for you, or only sometimes?

@Rvaler
Copy link

Rvaler commented Sep 30, 2021

Hey guys, I'm also having this same issue.

After some debug I noticed that it only happens when running on iOS 15, previous versions seem to be just fine.
Running on Xcode 13 - Intel Mac.

Hope it helps, cheers!

Full stack trace:

#0	0x00007fff20195d24 in class_createInstance ()
#1	0x00007fff20111182 in 0x7fff20111182 ()
#2	0x00007fff20116eb1 in 0x7fff20116eb1 ()
#3	0x00007fff2657649d in 0x7fff2657649d ()
#4	0x00007fff20111a56 in 0x7fff20111a56 ()
#5	0x00007fff20112ca5 in 0x7fff20112ca5 ()
#6	0x00007fff2658fa96 in 0x7fff2658fa96 ()
#7	0x00007fff2658fddb in 0x7fff2658fddb ()
#8	0x00007fff2658f3e4 in 0x7fff2658f3e4 ()
#9	0x00007fff20111a56 in 0x7fff20111a56 ()
#10	0x00007fff20112ca5 in 0x7fff20112ca5 ()
#11	0x00007fff2658f3be in 0x7fff2658f3be ()
#12	0x00007fff35daa897 in +[NEFilterSource filterRequired] ()
#13	0x00007fff298138ea in WebKit::WebPageProxy::createNetworkExtensionsSandboxExtensions(WebKit::WebProcessProxy&) ()
#14	0x00007fff29813705 in WebKit::WebPageProxy::addPlatformLoadParameters(WebKit::WebProcessProxy&, WebKit::LoadParameters&) ()
#15	0x00007fff298b1ef1 in WebKit::WebPageProxy::loadDataWithNavigationShared(WTF::Ref<WebKit::WebProcessProxy, WTF::RawPtrTraits<WebKit::WebProcessProxy> >&&, WTF::ObjectIdentifier<WebCore::PageIdentifierType>, API::Navigation&, IPC::ArrayReference<unsigned char, 18446744073709551615ul> const&, WTF::String const&, WTF::String const&, WTF::String const&, API::Object*, WebCore::ShouldTreatAsContinuingLoad, std::__1::optional<WebKit::NavigatingToAppBoundDomain>, std::__1::optional<WebKit::WebsitePoliciesData>&&, WebCore::ShouldOpenExternalURLsPolicy, WebCore::SubstituteData::SessionHistoryVisibility) ()
#16	0x00007fff298b1abd in WebKit::WebPageProxy::loadData(IPC::ArrayReference<unsigned char, 18446744073709551615ul> const&, WTF::String const&, WTF::String const&, WTF::String const&, API::Object*, WebCore::ShouldOpenExternalURLsPolicy) ()
#17	0x00007fff29771efb in -[WKWebView loadData:MIMEType:characterEncodingName:baseURL:] ()
#18	0x0000000109d211e4 in -[FIRDLJavaScriptExecutor start] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecutor.m:81
#19	0x0000000109d21134 in -[FIRDLJavaScriptExecutor initWithDelegate:script:] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecutor.m:69
#20	0x0000000109d20f26 in -[FIRDLDefaultRetrievalProcessV2 fetchLocaleFromWebView] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.m:252
#21	0x0000000109d24a45 in -[FIRDynamicLinks checkForPendingDynamicLink] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m:316
#22	0x0000000109d2416a in __39+[FIRDynamicLinks componentsToRegister]_block_invoke at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m:144
#23	0x0000000109ceb8ac in -[FIRComponentContainer instantiateInstanceForProtocol:withBlock:] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRComponentContainer.m:148
#24	0x0000000109ceba73 in -[FIRComponentContainer instanceForProtocol:] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRComponentContainer.m:182
#25	0x0000000109ceb7b1 in -[FIRComponentContainer instantiateEagerComponents] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRComponentContainer.m:125
#26	0x0000000109ce7bc1 in +[FIRApp configureWithName:options:] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRApp.m:206
#27	0x0000000109ce77f4 in +[FIRApp configureWithOptions:] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRApp.m:145
#28	0x0000000109ce7789 in +[FIRApp configure] at /Users/rafael/Buck-Test/green-mile-ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRApp.m:131
#29	0x000000010a898bad in AppDelegate.setupAnalytics(_:_:) at /Users/rafael/Buck-Test/green-mile-ios/myApp/Sources/AppDelegate/AppDelegate.swift:195
#30	0x000000010a8970f2 in AppDelegate.application(_:didFinishLaunchingWithOptions:) at /Users/rafael/Buck-Test/green-mile-ios/myApp/Sources/AppDelegate/AppDelegate.swift:100
#31	0x000000010a897da7 in @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) ()
#32	0x00007fff24ff7e21 in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#33	0x00007fff24ff9a91 in -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] ()
#34	0x00007fff24fff403 in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#35	0x00007fff24580668 in -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] ()
#36	0x00007fff24b693e2 in _UIScenePerformActionsWithLifecycleActionMask ()
#37	0x00007fff2458115f in __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke ()
#38	0x00007fff24580b95 in -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] ()
#39	0x00007fff24580f93 in -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] ()
#40	0x00007fff24580842 in -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] ()
#41	0x00007fff2458abc6 in __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke ()
#42	0x00007fff24a4e7a3 in +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] ()
#43	0x00007fff24b85f9a in _UISceneSettingsDiffActionPerformChangesWithTransitionContext ()
#44	0x00007fff2458a844 in -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] ()
#45	0x00007fff24389d6e in __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.573 ()
#46	0x00007fff2438871b in -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] ()
#47	0x00007fff2438992d in -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] ()
#48	0x00007fff24ffdce6 in -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] ()
#49	0x00007fff24a7e62e in -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] ()
#50	0x00007fff26483d98 in -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] ()
#51	0x00007fff264b04a3 in __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.180 ()
#52	0x00007fff2649221a in -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] ()
#53	0x00007fff264b0082 in __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke ()
#54	0x000000011026bc0c in _dispatch_client_callout ()
#55	0x000000011026eb7f in _dispatch_block_invoke_direct ()
#56	0x00007fff264d6dc8 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#57	0x00007fff264d6cbe in -[FBSSerialQueue _targetQueue_performNextIfPossible] ()
#58	0x00007fff264d6df0 in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#59	0x00007fff20369e25 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#60	0x00007fff20369d1d in __CFRunLoopDoSource0 ()
#61	0x00007fff203691f2 in __CFRunLoopDoSources0 ()
#62	0x00007fff20363951 in __CFRunLoopRun ()
#63	0x00007fff20363103 in CFRunLoopRunSpecific ()
#64	0x00007fff2c851cd3 in GSEventRunModal ()
#65	0x00007fff24ffbe63 in -[UIApplication _run] ()
#66	0x00007fff25000a53 in UIApplicationMain ()
#67	0x000000010a89f3d9 in main at /Users/rafael/Buck-Test/green-mile-ios/myApp/Sources/AppDelegate/main.swift:6
#68	0x000000010e2bae1e in start_sim ()

@crleonard
Copy link
Author

Above message form @Rvaler matches my experience. This is with Xcode 13 Release running against iOS 15

@crleonard
Copy link
Author

Any updates on this?

@paulb777
Copy link
Member

Looks like we're still looking for a reproduction example

@crleonard
Copy link
Author

crleonard commented Oct 12, 2021

Hi @paulb777 , I have attached here a link to a sample project you can download. If you run this on Xcode 13, with the simulator set on an iOS 15 device you will be able to re-produce the issue.

In AppDelegate you will see FirebaseApp.configure().

Let me know if this helps.

This will crash instantly when application loads.

https://github.com/crleonard/Firebase-TEST

@paulb777
Copy link
Member

Hi @crleonard Thanks for the repro, but it starts up fine for me. Please confirm that you have the latest versions:
Screen Shot 2021-10-12 at 9 58 25 AM

@crleonard
Copy link
Author

crleonard commented Oct 12, 2021

Hi @paulb777 Image below shows the same setup, though getting the same fatal error.

macOS Big Sur 11.3.1 (20E241)
iPhone 12 Pro Max (iOS 15) Simulator
Xcode 13

@paulb777
Copy link
Member

Hmm, it might be something triggered by your specific project. You could email the GoogleService-Info.plist to paulbeusterien at google.com.

Also, your screenshot shows Crashlytics starting and Crashlytics is not a dependency in the shared project. It's also showing it at 8.7.0 instead of the current version. And I don't see the TSK logging.

@allanragec
Copy link

allanragec commented Oct 14, 2021

I'm also having the same issue here.

macOS Big Sur 11.5.2 (Intel)
iPhone 11 Pro Max (iOS 15) Simulator
Xcode 13
FirebaseDynamicLinks (8.5.0)

image

Only works if I try to use simulators < iOS 15

@google-oss-bot
Copy link

Hey @crleonard. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@paulb777
Copy link
Member

Keeping this one open.

@ncooke3
Copy link
Member

ncooke3 commented Oct 21, 2021

Hi everyone,

I have been unable to reproduce this after trying in multiple projects and simulators. Since the crash is happening with a WebKit object, I have a hunch that there is an internal WebKit memory issue that is surfacing in certain instances.

I have a commit that attempts to test this but since I've been unable to reproduce, I'd appreciate it if someone that has consistently reproduced the issue can give it a try.

commit:

52fb358c0d12f9aa998b9a016cfe5ff60ae567bb

(Assuming you are using SPM... ) Re-integrate your project with SPM and point to the above specific commit. Example:
Screen Shot 2021-10-21 at 2 40 35 PM

Sorry again for the trouble and thank you!

@crleonard
Copy link
Author

Hello @ncooke3, checking out that specific commit and re-launching seems to be working for me.

@ncooke3
Copy link
Member

ncooke3 commented Oct 21, 2021

Thank you so much for the fast turn around @crleonard! I think we will move forward with this fix then. I'll keep this thread posted!

@allanragec
Copy link

allanragec commented Oct 22, 2021

Hi @ncooke3 , When the version 8.9.0 will be available on Cocoapods ?
For me, even after to run pod repo update, only version 8.8.0 is available, without this fix :(

Latest version is 8.8.0:

image

Thanks!

@paulb777
Copy link
Member

Hi @allanragec We're still working on the release process and testing of 8.9.0 and targeting to get it out next week. In the meantime, you could apply the fix from #8847 locally as a workaround

@allanragec
Copy link

Thank you @paulb777 :D

@allanragec
Copy link

allanragec commented Oct 22, 2021

I applied the change and the issue was resolved, thank you guys! Just waiting for the release 8.9.0 on Cocoapods

image

@lammertw
Copy link

I'm still having the same problem with 8.9.1.

@paulb777
Copy link
Member

@lammertw Sorry about the trouble. Your backtrace looks more like #7618 than this issue. Would you take a look at the discussion there, and if still stuck, open a new issue.

@lammertw
Copy link

@paulb777 Thanks, but it seems that #7618 was related to M1? I'm getting the crash in the Simulator on an Intel Macbook Pro.

@firebase firebase locked and limited conversation to collaborators Nov 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants