Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20623] iOS: The application has crashed with an uncaught exception 'org.voya_crash.TiUITabProxy'

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-03-29T20:52:58.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsn/a
ReporterChris Linseman
AssigneeHans Knöchel
Created2016-03-24T16:08:26.000+0000
Updated2017-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

FileDateSize
Resources.zip2016-03-24T16:00:01.000+0000689376

Comments

  1. Chris Linseman 2016-03-29

    Has anyone had a chance to look at this? I'd like to update our customer.
  2. Chris Linseman 2016-03-31

    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
  3. Pedro Enrique 2016-03-31

    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.
  4. Rick Blalock 2016-04-04

    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.
  5. Chee Kiat Ng 2016-05-03

    [~hansknoechel] please help here when you can.
  6. Hans Knöchel 2016-05-03

    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.
  7. Bert Grantges 2016-05-03

    Awesome - thanks Hans!
  8. Hans Knöchel 2016-05-13

    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.
  9. Ajith Rohini 2016-05-16

    [~clinseman] any update on this ?
  10. Chris Linseman 2016-05-17

    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.
  11. Hans Knöchel 2016-05-19

    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 the TiUITabProxy which is already nil'd. So the initializer of it is called again and tries to ensure, that the value of the window property of the proxy equals TiWindowProxy 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!
  12. ankur garha 2016-10-04

    Issue is reproducible on iPhone 6, iOS 10.0.2 (14A456) Ti SDK 5.4.0GA, Do we have any work around for it?
  13. Tim Poulsen (ACV) 2016-12-12

    I'm seeing this with 5.5.1.GA.
        Crashed Thread
        
        0	CoreFoundation 0x21a4398b __exceptionPreprocess + 124
        1	libobjc.A.dylib 0x211dee17 objc_exception_throw + 36
        2	ACV Auctions 0x000ba64b TiExceptionThrowWithNameAndReason (TiBase.m:197)
        3	ACV Auctions 0x00070dc7 -[TiUITabProxy rootController] (TiUITabProxy.m:101)
        4	ACV Auctions 0x000711dd -[TiUITabProxy closeWindowProxy:animated:] (TiUITabProxy.m:177)
        5	ACV Auctions 0x000bae75 __TiThreadPerformOnMainThread_block_invoke (TiBase.m:288)
        6	ACV Auctions 0x000baa59 TiThreadPerformOnMainThread (TiBase.m:308)
        7	ACV Auctions 0x00071a17 -[TiUITabProxy closeWindow:] (TiUITabProxy.m:281)
        8	ACV Auctions 0x000bae75 __TiThreadPerformOnMainThread_block_invoke (TiBase.m:288)
        9	ACV Auctions 0x000bb0ff TiThreadProcessPendingMainThreadBlocks (TiBase.m:399)
        10	ACV Auctions 0x0010eacd -[TiApp applicationWillTerminate:] + 336
        11	UIKit 0x2603e38d -[UIApplication _terminateWithStatus:] + 286
        12	UIKit 0x2625585d __102-[UIApplication _handleApplicationDeactivationWithScene:shouldForceExit:transitionContext:completion:]_block_invoke2019 + 906
        13	UIKit 0x26258369 _runAfterCACommitDeferredBlocks + 266
        14	UIKit 0x2626467b _cleanUpAfterCAFlushAndRunDeferredBlocks + 88
        15	UIKit 0x25fa2a4d _afterCACommitHandler + 82
        16	CoreFoundation 0x21a05739 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
        17	CoreFoundation 0x21a03a3d __CFRunLoopDoObservers + 278
        18	CoreFoundation 0x21a03e6f __CFRunLoopRun + 956
        19	CoreFoundation 0x219532e9 CFRunLoopRunSpecific + 518
        20	CoreFoundation 0x219530d5 CFRunLoopRunInMode + 106
        21	GraphicsServices 0x22f43ac9 GSEventRunModal + 158
        22	UIKit 0x260180b9 UIApplicationMain + 142
        23	ACV Auctions 0x0003594f main (main.m:37)
        
  14. Caio Perdona 2017-03-08

    @Hans So it is a 5.5.1.GA related bug? What about newer versions?
  15. Ben Bahrenburg 2017-03-08

    I've seen this behavior in my 6.0.x app.
  16. Hans Knöchel 2017-03-08

    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 lines

    To do that, it checks for the tab's window property that must contain a TiWindowProxy (internal class of Ti.UI.Window), but FAILS, because the proxy keys are deallocated already as well

    And that's the end. It gets nil and tries to validate it with ENSURE_TYPE which fails when providing nil

    So here is what we need to do: * Check for the nil'd rootWindow 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?
  17. Hans Knöchel 2017-03-08

    PR: https://github.com/appcelerator/titanium_mobile/pull/8866 [~emerriman] I'd consider this for 6.0.3.GA as well.
  18. Harry Bryant 2017-03-30

    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.*

JSON Source