[TIMOB-20623] iOS: The application has crashed with an uncaught exception 'org.voya_crash.TiUITabProxy'
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-03-29T20:52:58.000+0000 |
Affected Version/s | Release 5.2.0 |
Fix Version/s | Release 6.1.0 |
Components | iOS |
Labels | n/a |
Reporter | Chris Linseman |
Assignee | Hans Knöchel |
Created | 2016-03-24T16:08:26.000+0000 |
Updated | 2017-03-30T13:49:21.000+0000 |
Description
Following the steps below causes the app to crash with:
The application has crashed with an uncaught exception 'org.voya_crash.TiUITabProxy'.
Reason:
Invalid type passed to function
1) Create a classic Titanium app for iOS
2) Replace the Resources with the ones from the attachment
3) Run in iOS Simulator
4) Click on the 'Welcome' message
5) Click on 'tab2'
6) Click on 'welcome2'
7) Click on tab1
8) Click on 'welcome1'
9) Background the app and close it from the Multitasking screen
10) App crashes
Console output of crash:
[ERROR] : The application has crashed with an uncaught exception 'org.voya_crash.TiUITabProxy'.
[ERROR] : Reason:
[ERROR] : Invalid type passed to function
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x000000010ce86d6d __exceptionPreprocess + 141
[ERROR] : 1 libobjc.A.dylib 0x000000010c854deb objc_exception_throw + 48
[ERROR] : 2 voya_crash 0x000000010702ff78 TiExceptionThrowWithNameAndReason + 200
[ERROR] : 3 voya_crash 0x0000000106ff8819 -[TiProxy throwException:subreason:location:] + 105
[ERROR] : 4 voya_crash 0x0000000106f8f14d -[TiUITabProxy rootController] + 429
[ERROR] : 5 voya_crash 0x0000000106f8f73b -[TiUITabProxy closeWindowProxy:animated:] + 107
[ERROR] : 6 voya_crash 0x0000000106f8f581 -[TiUITabProxy closeOnUIThread:] + 401
[ERROR] : 7 voya_crash 0x0000000106f903ea __28-[TiUITabProxy closeWindow:]_block_invoke + 42
[ERROR] : 8 voya_crash 0x0000000107030b94 __TiThreadPerformOnMainThread_block_invoke + 52
[ERROR] : 9 voya_crash 0x00000001070305d7 TiThreadPerformOnMainThread + 407
[ERROR] : 10 voya_crash 0x0000000106f903b2 -[TiUITabProxy closeWindow:] + 610
[ERROR] : 11 voya_crash 0x000000010713156f -[TiWindowProxy close:] + 335
[ERROR] : 12 voya_crash 0x0000000106f7048a __27-[TiUIWindowProxy _destroy]_block_invoke + 42
[ERROR] : 13 voya_crash 0x0000000107030b94 __TiThreadPerformOnMainThread_block_invoke + 52
[ERROR] : 14 voya_crash 0x0000000107030f23 TiThreadProcessPendingMainThreadBlocks + 403
[ERROR] : 15 voya_crash 0x00000001070e740f -[TiApp waitForKrollProcessing] + 159
[ERROR] : 16 voya_crash 0x00000001070e75af -[TiApp applicationWillTerminate:] + 399
[ERROR] : 17 UIKit 0x0000000108e20401 -[UIApplication _terminateWithStatus:] + 136
[ERROR] : 18 UIKit 0x0000000108e214fc __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke1979 + 911
[ERROR] : 19 UIKit 0x0000000108e24f62 _runAfterCACommitDeferredBlocks + 317
[ERROR] : 20 UIKit 0x0000000108e38e4c _cleanUpAfterCAFlushAndRunDeferredBlocks + 95
[ERROR] : 21 UIKit 0x0000000108e45147 _afterCACommitHandler + 90
[ERROR] : 22 CoreFoundation 0x000000010cdabc37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
[ERROR] : 23 CoreFoundation 0x000000010cdabba7 __CFRunLoopDoObservers + 391
[ERROR] : 24 CoreFoundation 0x000000010cda17fb __CFRunLoopRun + 1147
[ERROR] : 25 CoreFoundation 0x000000010cda10f8 CFRunLoopRunSpecific + 488
[ERROR] : 26 GraphicsServices 0x000000010e99bad2 GSEventRunModal + 161
[ERROR] : 27 UIKit 0x0000000108e18f09 UIApplicationMain + 171
[ERROR] : 28 voya_crash 0x0000000106f1abb6 main + 310
[ERROR] : 29 libdyld.dylib 0x000000010e29f92d start + 1
[ERROR] :
[ERROR] : 2016-03-24 14:51:52.487 voya_crash[28440:14850942] *** Terminating app due to uncaught exception 'org.voya_crash.TiUITabProxy', reason: 'Invalid type passed to function'
[ERROR] : *** First throw call stack:
[ERROR] : (
[ERROR] : 0 CoreFoundation 0x000000010ce86d85 __exceptionPreprocess + 165
[ERROR] : 1 libobjc.A.dylib 0x000000010c854deb objc_exception_throw + 48
[ERROR] : 2 voya_crash 0x000000010702ff78 TiExceptionThrowWithNameAndReason + 200
[ERROR] : 3 voya_crash 0x0000000106ff8819 -[TiProxy throwException:subreason:location:] + 105
[ERROR] : 4 voya_crash 0x0000000106f8f14d -[TiUITabProxy rootController] + 429
[ERROR] : 5 voya_crash 0x0000000106f8f73b -[TiUITabProxy closeWindowProxy:animated:] + 107
[ERROR] : 6 voya_crash 0x0000000106f8f581 -[TiUITabProxy closeOnUIThread:] + 401
[ERROR] : 7 voya_crash 0x0000000106f903ea __28-[TiUITabProxy closeWindow:]_block_invoke + 42
[ERROR] : 8 voya_crash 0x0000000107030b94 __TiThreadPerformOnMainThread_block_invoke + 52
[ERROR] : 9 voya_crash 0x00000001070305d7 TiThreadPerformOnMainThread + 407
[ERROR] : 10 voya_crash 0x0000000106f903b2 -[TiUITabProxy closeWindow:] + 610
[ERROR] : 11 voya_crash 0x000000010713156f -[TiWindowProxy close:] + 335
[ERROR] : 12 voya_crash 0x0000000106f7048a __27-[TiUIWindowProxy _destroy]_block_invoke + 42
[ERROR] : 13 voya_crash 0x0000000107030b94 __TiThreadPerformOnMainThread_block_invoke + 52
[ERROR] : 14 voya_crash 0x0000000107030f23 TiThreadProcessPendingMainThreadBlocks + 403
[ERROR] : 15 voya_crash 0x00000001070e740f -[TiApp waitForKrollProcessing] + 159
[ERROR] : 16 voya_crash 0x00000001070e75af -[TiApp applicationWillTerminate:] + 399
[ERROR] : 17 UIKit 0x0000000108e20401 -[UIApplication _terminateWithStatus:] + 136
[ERROR] : 18 UIKit 0x0000000108e214fc __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke1979 + 911
[ERROR] : 19 UIKit 0x0000000108e24f62 _runAfterCACommitDeferredBlocks + 317
[ERROR] : 20 UIKit 0x0000000108e38e4c _cleanUpAfterCAFlushAndRunDeferredBlocks + 95
[ERROR] : 21 UIKit 0x0000000108e45147 _afterCACommitHandler + 90
[ERROR] : 22 CoreFoundation 0x000000010cdabc37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
[ERROR] : 23 CoreFoundation 0x000000010cdabba7 __CFRunLoopDoObservers + 391
[ERROR] : 24 CoreFoundation 0x000000010cda17fb __CFRunLoopRun + 1147
[ERROR] : 25 CoreFoundation 0x000000010cda10f8 CFRunLoopRunSpecific + 488
[ERROR] : 26 GraphicsServices 0x000000010e99bad2 GSEventRunModal + 161
[ERROR] : 27 UIKit 0x0000000108e18f09 UIApplicationMain + 171
[ERROR] : 28 voya_crash 0x0000000106f1abb6 main + 310
[ERROR] : 29 libdyld.dylib 0x000000010e29f92d start + 1
[ERROR] : )
[ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException
Attachments
File | Date | Size |
---|---|---|
Resources.zip | 2016-03-24T16:00:01.000+0000 | 689376 |
Has anyone had a chance to look at this? I'd like to update our customer.
Here's a link to a video showing the issue using the steps above. https://www.dropbox.com/s/weqy1zv3y816562/iphone5_voya.mov?dl=0
Resolving this issue as invalid. We've had this issue come up before a number of times. The main issue is that a TabGroup is meant to be a "main view controller" and they're not supposed to be closed. TabGroups, NavigationWindows, and SplitWindows, are supposed to be the main view controller of the app and we do not support having multiple at the same time, or opening them after another window is already open. There are some things that can be done, but we'll need to understand the specific use case.
It's not invalid. It's a crash on something you can do natively or otherwise. Just because it doesn't match the HIG perfectly doesn't mean its invalid.
[~hansknoechel] please help here when you can.
It crashes inside the global cleanup before app termination so the goal should be to cleanup the tabgroup proxy properly, as well as its childs. Will take a look at it.
Awesome - thanks Hans!
I would greatly appreciate an reproducible example that fits in a single app.js so we can debug it more performant and dont need to spend time on unrelated code.
[~clinseman] any update on this ?
Can you work with the code provided? It took a lot of effort to come up with a reproducible test case as is, and this most accurately reflects the clients specific use case.
Hey there! So I spent some time on debugging the closing-process of our core and I was unable to reproduce the issue with our latest master (tested with both kroll- and main-thread). Then I remembered the ticket I worked on a few month that fixed something related (TIMOB-20298). So I would like to ask you if you can try using the latest 5.2.2.GA or the latest 5.4.0 build (http://builds.appcelerator.com/#master). If you need further help, please ping me on Slack. Thank you! *EDIT:* Some more technical context on this: We clean up the tabgroup when terminating the application and call several methods like above tracked. Finally, we reference the
rootViewController
of theTiUITabProxy
which is already nil'd. So the initializer of it is called again and tries to ensure, that the value of thewindow
property of the proxy equalsTiWindowProxy
which is also already garbage-collected. The above-mentioned fix should detect that at a early point and skip this deep-cleanup when the application is already terminating. So far so good, I hope the solution helps. Thanks!Issue is reproducible on iPhone 6, iOS 10.0.2 (14A456) Ti SDK 5.4.0GA, Do we have any work around for it?
I'm seeing this with 5.5.1.GA.
@Hans So it is a 5.5.1.GA related bug? What about newer versions?
I've seen this behavior in my 6.0.x app.
The fix is happening in all known versions of the SDK and the behavior can be seen (rarely) when force-closing the app. It crashes because the cleanup of the view-stack accesses an already deallocated proxy from
applicationWillTerminate
. It is still a crash and all crashes should and will be investigated, but as it does not crash from the for- or background but from a gesture that closes the app anyway, it isn't a blocker at this time. I will look into it today again, but crashes happening while force-closing are not the easiest ones to catch, because the debugger connection also cuts at a certain point. I hope that gives everybody affected a quick insight and I'll keep you posted here. *EDIT*: OK, here's what's going on in detail:The application is in a termination state
The termination process takes care of cleaning up all UI elements and comes to [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUITabProxy.m#L169)
It wants to close the window and tries to access the
\[self rootViewController\]
in [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUITabProxy.m#L175)It reaches the getter [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUITabProxy.m#L98), but the
rootWindow
was already deallocated and nil'd, so it tries to recreate it over the next linesTo do that, it checks for the tab's
window
property that must contain aTiWindowProxy
(internal class ofTi.UI.Window
), but FAILS, because the proxy keys are deallocated already as wellAnd that's the end. It gets
So here is what we need to do: * Check for the nil'dnil
and tries to validate it withENSURE_TYPE
which fails when providing nilrootWindow
before calling the getter to ensure it doesn't try to recreate it * If it's already deallocated, we skip the next few lines of the termination process to finish and close the app properly End of story. [~ben.bahrenburg@gmail.com], you did a lot of iOS as well, does that sound reasonable for you?PR: https://github.com/appcelerator/titanium_mobile/pull/8866 [~emerriman] I'd consider this for 6.0.3.GA as well.
Verified as fixed, followed the test steps provided above on device, and tested for crashes for 30 attempts. Unable to reproduce the error in question. Tested On: iPhone 7 10.2.1 Device & Simulator Mac OS Sierra (10.12.2) Ti SDK: 6.1.0.v20170329142425 Appc Studio: 4.8.1.201701192045 Appc NPM: 4.2.9-1 App CLI: 6.1.0 Xcode 8.2.1 Node v4.6.0 *Closing ticket.*