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

Sporadic crash on app exit - iOS 13.5.1 #51

Closed
NathanWalker opened this issue Jun 29, 2020 · 7 comments
Closed

Sporadic crash on app exit - iOS 13.5.1 #51

NathanWalker opened this issue Jun 29, 2020 · 7 comments
Assignees

Comments

@NathanWalker
Copy link
Contributor

In a current app on TestFlight, some testers are encountering this occasionally when the app exits (full crashlog attached):

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib        	0x00000001a4456df0 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x00000001a4376930 pthread_kill + 228 (pthread.c:1458)
2   libsystem_c.dylib             	0x00000001a4304c24 __abort + 116 (abort.c:147)
3   libsystem_c.dylib             	0x00000001a4304bb0 abort + 116 (abort.c:118)
4   libc++abi.dylib               	0x00000001a4429f40 abort_message + 132 (abort_message.cpp:76)
5   libc++abi.dylib               	0x00000001a441b8b0 demangling_terminate_handler() + 284 (cxa_default_handlers.cpp:60)
6   libobjc.A.dylib               	0x00000001a4384f1c _objc_terminate() + 148 (objc-exception.mm:704)
7   TNSCrashlyticsLogger          	0x0000000108849cb8 CLSTerminateHandler() + 348
8   libc++abi.dylib               	0x00000001a44293cc std::__terminate(void (*)()) + 20 (cxa_handlers.cpp:59)
9   libc++abi.dylib               	0x00000001a4429358 std::terminate() + 44 (cxa_handlers.cpp:88)
10  NativeScript                  	0x0000000105f0ed60 std::__1::shared_ptr<v8::Persistent<v8::Value, v8::NonCopyablePersistentTraits<v8::Value> > >::~shared_ptr() + 64
11  libsystem_c.dylib             	0x00000001a42e5164 __cxa_finalize_ranges + 416 (atexit.c:284)
12  libsystem_c.dylib             	0x00000001a42e54a0 exit + 28 (exit.c:81)
13  UIKitCore                     	0x00000001a87beb88 -[UIApplication _terminateWithStatus:] + 508 (UIApplication.m:6735)
14  UIKitCore                     	0x00000001a7f27718 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 128 (_UISceneLifecycleMultiplexer.m:765)
15  UIKitCore                     	0x00000001a7f2737c -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 220 (_UISceneLifecycleMultiplexer.m:418)
16  UIKitCore                     	0x00000001a87b4ac4 -[UIApplication workspaceShouldExit:withTransitionContext:] + 216 (UIApplication.m:3725)
17  FrontBoardServices            	0x00000001a98cbcf8 -[FBSUIApplicationWorkspaceShim workspaceShouldExit:withTransitionContext:] + 88 (FBSUIApplicationWorkspace.m:144)
18  FrontBoardServices            	0x00000001a98f8d68 __83-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:withAcknowledgement:]_block_invoke_2 + 80 (FBSWorkspaceScenesClient.m:281)
19  FrontBoardServices            	0x00000001a98ddebc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240 (FBSWorkspace.m:357)
20  FrontBoardServices            	0x00000001a98f8cf4 __83-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:withAcknowledgement:]_block_invoke + 140 (FBSWorkspaceScenesClient.m:278)
21  libdispatch.dylib             	0x00000001a431033c _dispatch_client_callout + 20 (object.m:495)
22  libdispatch.dylib             	0x00000001a43130d4 _dispatch_block_invoke_direct + 264 (queue.c:466)
23  FrontBoardServices            	0x00000001a991f6c4 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48 (FBSSerialQueue.m:173)
24  FrontBoardServices            	0x00000001a991f370 -[FBSSerialQueue _queue_performNextIfPossible] + 432 (FBSSerialQueue.m:216)
25  FrontBoardServices            	0x00000001a991f8dc -[FBSSerialQueue _performNextFromRunLoopSource] + 32 (FBSSerialQueue.m:247)
26  CoreFoundation                	0x00000001a45ebaf4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1922)
27  CoreFoundation                	0x00000001a45eba48 __CFRunLoopDoSource0 + 84 (CFRunLoop.c:1956)
28  CoreFoundation                	0x00000001a45eb198 __CFRunLoopDoSources0 + 196 (CFRunLoop.c:1992)
29  CoreFoundation                	0x00000001a45e5f38 __CFRunLoopRun + 796 (CFRunLoop.c:2882)
30  CoreFoundation                	0x00000001a45e58f4 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)
31  GraphicsServices              	0x00000001ae9fc604 GSEventRunModal + 164 (GSEvent.c:2246)
32  UIKitCore                     	0x00000001a87b9358 UIApplicationMain + 
1944 (UIApplication.m:4823)
33  NativeScript                  	0x0000000106054044 ffi_call_SYSV + 68


crashlog.txt

@adrian-niculescu
Copy link

We are experiencing this issue as well.

@adrian-branescu
Copy link

I think the problem is inside Runtime destructor at this line.

As long as I understand ->Enter() and ->Exit() V8 API calls must be paired. That's what stack allocated instances of Isolate::Scope, Context::Scope etc actually do: they perform an ->Enter() call in their constructor and an ->Exit() call in their destructor.

I don't understand why an Isolate->Exit() is manually performed in the Runtime destructor. It's not paired with an Isolate->Enter() call and leads to crashes.

You should take inspiration from { N } Android Runtime. Here is an example of a proper usage of the V8 API.

@darind
Copy link
Collaborator

darind commented Oct 19, 2020

Yes, I believe this is a leftover from previous refactorings and can be removed. @adrian-branescu, would you mind submitting a PR for this?

@NathanaelA

This comment was marked as abuse.

@NathanaelA

This comment was marked as abuse.

@romandrahan
Copy link

romandrahan commented Nov 1, 2020

@NathanaelA, sad to report, but 7.0.4 runtime brings another related issue: the app crashes right after "swipe to close" action on iOS. It work just fine on 7.0.3 runtime though.

Reproducible only on real device, fine on simulator.

Demo: https://drive.google.com/file/d/1T8eU3LQb4q9_ZDkw0ZWB4jHccEACRZov/view?usp=sharing

@ruidscampos
Copy link

ruidscampos commented Nov 4, 2020

Confirm this still happens, raised an issue on the main Nativescript project, but looks like a direct match to this one.

Added a bit more information in my original issue report here:
NativeScript/NativeScript#8995

@EddyVerbruggen has tested this with a few versions and added some worthy insights in my original issue.

Here's the trace:

Incident Identifier: EE6F69AF-9928-4F1A-8A1F-478C802875AC
Hardware Model:      iPad8,1
Process:             mobile [631]
Path:                /private/var/containers/Bundle/Application/97611BA7-D13D-486D-BE3C-B60FD53C19AF/mobile.app/mobile
Identifier:          a.a.a
Version:             1.0.6 (1.0.6)
AppStoreTools:       12A7604b
AppVariant:          1:iPad8,1:14
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           a.a.a [540]


Date/Time:           2020-10-30 13:12:24.9266 +0000
Launch Time:         2020-10-30 13:12:18.7557 +0000
OS Version:          iPhone OS 14.1 (18A8395)
Release Type:        User
Baseband Version:    n/a
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x0000000101c28128
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [631]
Triggered by Thread:  0

0   NativeScript                  	0x0000000101c28128 v8::base::OS::Abort() + 24
1   NativeScript                  	0x0000000101375d14 v8::Isolate::Dispose() + 160
2   NativeScript                  	0x00000001012b0f38 tns::Runtime::~Runtime() + 164
3   NativeScript                  	0x00000001011fb73c std::__1::shared_ptr<v8::Persistent<v8::Value, v8::NonCopyablePersistentTraits<v8::Value> > >::~shared_ptr() + 64
4   libsystem_c.dylib             	0x0000000198c55328 __cxa_finalize_ranges + 408 (atexit.c:284)
5   libsystem_c.dylib             	0x0000000198c55668 exit + 28 (exit.c:81)
6   UIKitCore                     	0x000000019246aa8c -[UIApplication _terminateWithStatus:] + 504 (UIApplication.m:6534)
7   UIKitCore                     	0x0000000191af3db0 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 128 (_UISceneLifecycleMultiplexer.m:819)
8   UIKitCore                     	0x0000000191af3a10 -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 220 (_UISceneLifecycleMultiplexer.m:457)
9   UIKitCore                     	0x0000000192460770 -[UIApplication workspaceShouldExit:withTransitionContext:] + 212 (UIApplication.m:3600)
10  FrontBoardServices            	0x000000019eb22988 -[FBSUIApplicationWorkspaceShim workspaceShouldExit:withTransitionContext:] + 88 (FBSUIApplicationWorkspace.m:144)
11  FrontBoardServices            	0x000000019eb500a4 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 + 80 (FBSWorkspaceScenesClient.m:312)
12  FrontBoardServices            	0x000000019eb34d24 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240 (FBSWorkspace.m:355)
13  FrontBoardServices            	0x000000019eb5003c __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke + 132 (FBSWorkspaceScenesClient.m:309)
14  libdispatch.dylib             	0x000000018f73aac8 _dispatch_client_callout + 20 (object.m:559)
15  libdispatch.dylib             	0x000000018f73e348 _dispatch_block_invoke_direct + 268 (queue.c:468)
16  FrontBoardServices            	0x000000019eb780e0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48 (FBSSerialQueue.m:184)
17  FrontBoardServices            	0x000000019eb77d88 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 448 (FBSSerialQueue.m:227)
18  FrontBoardServices            	0x000000019eb782ac -[FBSSerialQueue _performNextFromRunLoopSource] + 32 (FBSSerialQueue.m:258)
19  CoreFoundation                	0x000000018fab981c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1967)
20  CoreFoundation                	0x000000018fab9718 __CFRunLoopDoSource0 + 208 (CFRunLoop.c:2011)
21  CoreFoundation                	0x000000018fab8a28 __CFRunLoopDoSources0 + 268 (CFRunLoop.c:2048)
22  CoreFoundation                	0x000000018fab2d20 __CFRunLoopRun + 824 (CFRunLoop.c:2925)
23  CoreFoundation                	0x000000018fab24bc CFRunLoopRunSpecific + 600 (CFRunLoop.c:3242)
24  GraphicsServices              	0x00000001a65c4820 GSEventRunModal + 164 (GSEvent.c:2259)
25  UIKitCore                     	0x000000019245f164 -[UIApplication _run] + 1072 (UIApplication.m:3270)
26  UIKitCore                     	0x0000000192464840 UIApplicationMain + 168 (UIApplication.m:4739)
27  NativeScript                  	0x0000000101358044 ffi_call_SYSV + 68
28  NativeScript                  	0x00000001013564f0 ffi_call_int + 968
29  NativeScript                  	0x00000001012ca5d0 tns::Interop::CallFunctionInternal(tns::MethodCall&) + 428
30  NativeScript                  	0x000000010126d160 std::__1::__function::__func<tns::MetadataBuilder::CFunctionCallback(v8::FunctionCallbackInfo<v8::Value> const&)::$_2, std::__1::allocator<tns::MetadataBuilder::CFunctionCallback(v8::FunctionCallba... + 564
31  NativeScript                  	0x0000000101306e9c tns::Tasks::Drain() + 108
32  NativeScript                  	0x0000000101300f60 +[NativeScript start:] + 572
33  mobile                        	0x00000001008c3c4c main + 260 (main.m:58)
34  libdyld.dylib                 	0x000000018f779e40 start + 4

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

Successfully merging a pull request may close this issue.

7 participants