Skip to content
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

NS runtime crashes in iOS18 Simulators #262

Open
cjohn001 opened this issue Sep 22, 2024 · 2 comments
Open

NS runtime crashes in iOS18 Simulators #262

cjohn001 opened this issue Sep 22, 2024 · 2 comments

Comments

@cjohn001
Copy link

cjohn001 commented Sep 22, 2024

Hello together,
I am currently trying to migrate my app from NS 8.7 to 8.8. It seems like NS has an issue on simulators running iOS18. The relevant code block which kills the runtime is the following, hence opening an SFSafariViewController breaks the app. The crash log is attached below,

crashiOS18SimOniPhone15Pro.txt

seems like it is a V8 related issue.

private openUrlWithParametersCompletion(fullUrl: string, frame: Frame): void {
		SFSafariViewController.prewarmConnectionsToURLs([NSURL.URLWithString(fullUrl)]);
		this.safariViewController = SFSafariViewController.alloc().initWithURL(NSURL.URLWithString(fullUrl));

		// color of top and bottom bar
		if (this.styleOptions) {
			this.safariViewController.preferredBarTintColor = this.styleOptions.preferredBarTintColor.ios;
		}
		// color of the buttons
		if (this.styleOptions) {
			this.safariViewController.preferredControlTintColor = this.styleOptions.preferredControlTintColor.ios;
		}
		// text for dismiss button can be Done, Close, Cancel
		this.safariViewController.dismissButtonStyle = SFSafariViewControllerDismissButtonStyle.Done;
		this.safariViewController.delegate = this;
		if (!this._timeout) {
			this._timeout = setTimeout(() => {
				const windowScene = UIApplication.sharedApplication.connectedScenes.allObjects.firstObject as UIWindowScene;
				if (windowScene) {
					const keyWindow = windowScene.windows.firstObject as UIWindow;
					if (keyWindow.keyWindow) {
						let rootVC = keyWindow.rootViewController;
						rootVC.presentViewControllerAnimatedCompletion(this.safariViewController, true, null);
					} else {
						console.error('no key window');
					}
				}
				this._timeout = null;
			}, 150);
		}
	}
OS: macOS 15.0
CPU: (10) arm64 Apple M1 Pro
Shell: /bin/zsh
node: 20.11.1
npm: 10.2.4
nativescript: 8.8.2

# android
java: 17.0.12
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: 16.0/16A242d
cocoapods: 1.15.2
python: 3.12.4
python3: 3.12.4
ruby: 2.7.8
platforms: 
  - DriverKit 24.0
  - iOS 18.0
  - macOS 15.0
  - tvOS 18.0
  - visionOS 2.0
  - watchOS 11.0

Dependencies

"dependencies": {
  "@angular/animations": "18.2.5",
  "@angular/common": "18.2.5",
  "@angular/compiler": "18.2.5",
  "@angular/core": "18.2.5",
  "@angular/forms": "18.2.5",
  "@angular/platform-browser": "18.2.5",
  "@angular/platform-browser-dynamic": "18.2.5",
  "@angular/router": "18.2.5",
  "@apollo/client": "3.11.8",
  "@mnd/external-web-view": "file:../app-plugins/dist/packages/external-web-view/mnd-external-web-view-2.0.0.tgz",
  "@nativescript/angular": "18.1.3",
  "@nativescript/core": "8.8.2",
  "@nativescript/iqkeyboardmanager": "2.1.1",
  "@nativescript/localize": "5.2.0",
  "@nativescript/mlkit-barcode-scanning": "2.1.0",
  "@nativescript/mlkit-core": "2.1.0",
  "@nativescript/secure-storage": "3.0.3",
  "@nativescript/theme": "3.1.0",
  "@nativescript/ui-charts": "0.2.4",
  "apollo-angular": "7.2.0",
  "apollo3-cache-persist": "0.15.0",
  "d3-ease": "3.0.1",
  "graphql": "16.9.0",
  "graphql-tag": "2.12.6",
  "intl": "1.2.5",
  "moment": "2.30.1",
  "nativescript-health-data": "file:../app-plugins-customized/nativescript-health-data/publish/package/nativescript-health-data-3.0.0.tgz",
  "nativescript-oauth2-ext": "file:../app-plugins-customized/nativescript-oauth2-ext/publish/package/nativescript-oauth2-ext-3.0.4.tgz",
  "nativescript-sqlite": "2.8.6",
  "nativescript-sqlite-commercial": "file:../app-plugins-customized/commercial-sqlite/nativescript-sqlite-commercial-1.8.0.tgz",
  "nativescript-ui-calendar": "15.2.3",
  "nativescript-ui-gauge": "15.2.3",
  "qs": "npm:[email protected]",
  "rxjs": "7.8.1",
  "util": "0.12.5",
  "uuidjs": "5.1.0",
  "zone.js": "0.15.0"
},
"devDependencies": {
  "@angular-devkit/build-angular": "18.2.5",
  "@angular/compiler-cli": "18.2.5",
  "@graphql-codegen/cli": "5.0.2",
  "@graphql-codegen/fragment-matcher": "5.0.2",
  "@graphql-codegen/introspection": "4.0.3",
  "@graphql-codegen/typescript": "4.0.9",
  "@graphql-codegen/typescript-apollo-angular": "4.0.0",
  "@graphql-codegen/typescript-operations": "4.2.3",
  "@nativescript/android": "8.7.0",
  "@nativescript/ios": "8.8.2",
  "@nativescript/types": "8.8.0",
  "@nativescript/webpack": "5.0.22",
  "@ngtools/webpack": "18.2.5",
  "@types/d3-ease": "3.0.2",
  "@types/intl": "1.2.2",
  "@types/lodash": "4.17.7",
  "@types/node": "22.5.5",
  "keycloak-request-token": "0.1.0",
  "rimraf": "6.0.1",
  "sass": "1.77.8",
  "ts-node": "10.9.2",
  "typescript": "5.5.4"
}
@cjohn001
Copy link
Author

cjohn001 commented Dec 19, 2024

@edusperoni I have seen that you are actively developing on the runtime. Unfortunately, since NS 8.8 I am observing crashes when starting the ios app on an simulator with IOS 18, 18.1 and 18.2. I was now able to get some more insights when debugging with xcode. Unfortunately, I have no idea where to look for in the VS8 code.
Might you have some directions on how I could get to the source of the issue?

Note: When running on IOS 17.x simulators I am not seeing the issue. Also I see random crashes of my app on real devices when the app switches between for and background. As this happens not very often I suspect it to be a timing related issue.

When starting the app, the app tries to login via oauth, hence opening a safari browser. I suspect the foreground background switch of the app to be involved with the issue.


NativeScript`tns::ObjectManager::FinalizerCallback:
    0x112e56a3e <+0>:   pushq  %rbp
    0x112e56a3f <+1>:   movq   %rsp, %rbp
    0x112e56a42 <+4>:   pushq  %r14
    0x112e56a44 <+6>:   pushq  %rbx
    0x112e56a45 <+7>:   movq   (%rdi), %r14
    0x112e56a48 <+10>:  movq   0x8(%rdi), %rbx
    0x112e56a4c <+14>:  movq   (%rbx), %rax
->  0x112e56a4f <+17>:  movq   (%rax), %rax
    0x112e56a52 <+20>:  testq  %rax, %rax
    0x112e56a55 <+23>:  je     0x112e56a67               ; <+41> at v8-local-handle.h
    0x112e56a57 <+25>:  movq   (%rax), %rsi
    0x112e56a5a <+28>:  movq   %r14, %rdi
    0x112e56a5d <+31>:  callq  0x112f0a990               ; v8::HandleScope::CreateHandle(v8::internal::Isolate*, unsigned long)
    0x112e56a62 <+36>:  movq   %rax, %rsi
    0x112e56a65 <+39>:  jmp    0x112e56a69               ; <+43> at ObjectManager.mm:34:21
    0x112e56a67 <+41>:  xorl   %esi, %esi
    0x112e56a69 <+43>:  movq   %r14, %rdi
    0x112e56a6c <+46>:  xorl   %edx, %edx
    0x112e56a6e <+48>:  callq  0x112e56ac6               ; tns::ObjectManager::DisposeValue at ObjectManager.mm:45
    0x112e56a73 <+53>:  movq   (%rbx), %r14
    0x112e56a76 <+56>:  movq   (%r14), %rdi
    0x112e56a79 <+59>:  testb  %al, %al
    0x112e56a7b <+61>:  je     0x112e56aa2               ; <+100> [inlined] void* v8::PersistentBase<v8::Value>::ClearWeak<void>() at v8-persistent-handle.h:533:31
    0x112e56a7d <+63>:  testq  %rdi, %rdi
    0x112e56a80 <+66>:  je     0x112e56a8e               ; <+80> [inlined] std::__1::shared_ptr<v8::Persistent<v8::Value, v8::NonCopyablePersistentTraits<v8::Value>>>::~shared_ptr[abi:ue170006]() at shared_ptr.h:771:5
    0x112e56a82 <+68>:  callq  0x112f0a450               ; v8::api_internal::DisposeGlobal(unsigned long*)
    0x112e56a87 <+73>:  movq   $0x0, (%r14)
    0x112e56a8e <+80>:  movq   %rbx, %rdi
    0x112e56a91 <+83>:  callq  0x112e755e0               ; std::__1::shared_ptr<v8::Persistent<v8::Value, v8::NonCopyablePersistentTraits<v8::Value>>>::~shared_ptr[abi:ue170006] at shared_ptr.h:771
    0x112e56a96 <+88>:  movq   %rbx, %rdi
    0x112e56a99 <+91>:  popq   %rbx
    0x112e56a9a <+92>:  popq   %r14
    0x112e56a9c <+94>:  popq   %rbp
    0x112e56a9d <+95>:  jmp    0x113aa9b66               ; symbol stub for: operator delete(void*)
    0x112e56aa2 <+100>: callq  0x112f0a430               ; v8::api_internal::ClearWeak(unsigned long*)
    0x112e56aa7 <+105>: movq   (%rbx), %rax
    0x112e56aaa <+108>: movq   (%rax), %rdi
    0x112e56aad <+111>: leaq   -0x76(%rip), %rdx         ; <+0> at ObjectManager.mm:30
    0x112e56ab4 <+118>: movq   %rbx, %rsi
    0x112e56ab7 <+121>: movl   $0x2, %ecx
    0x112e56abc <+126>: popq   %rbx
    0x112e56abd <+127>: popq   %r14
    0x112e56abf <+129>: popq   %rbp
    0x112e56ac0 <+130>: jmp    0x112f0a410               ; v8::api_internal::MakeWeak(unsigned long*, void*, void (*)(v8::WeakCallbackInfo<void> const&), v8::WeakCallbackType)
Bildschirmfoto 2024-12-20 um 00 14 22 Bildschirmfoto 2024-12-20 um 00 15 23 Bildschirmfoto 2024-12-20 um 00 15 33

crashdump.txt

@cjohn001
Copy link
Author

cjohn001 commented Dec 20, 2024

Seems like my assumption with SFSafariViewController being the problem is a different issue which is explainable via an iOS18bug.

https://developer.apple.com/forums/thread/764468?answerId=806060022#806060022

However, the bug I am seeing above also seems to appear on real devices which would denote the IOS18 issue in the mentioned thread cannot be the source of the problem of my observation.

The issue documented in the thread looks exactly the same like in my usecase, but seems like I am seeing two overlapping issues here:

https://github.com/user-attachments/assets/0504e082-20cb-4962-ac3b-b6af5fe36c5f
https://github.com/user-attachments/assets/fdf16d3e-5f5c-464c-afba-4344a01ad9a6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant