I'm investigating a crash in my game when exiting via the SpringBoard. I've narrowed it down to my use of Amazon Insignts which I recently added to my game. If I remove any usage of insights then the game will exit normally but if I instantiate an instance of the AIAmazonInsights object (using bhwax) then my app crashes on exit with the call stack below.
From what I can tell someone has registered an exit handler via __cxa_atexit() with NULL as the callback, hence why the callstack shows 0x0 as the current function running. My guess was that this must be the Amazon but dumping their framework's symbol table I see no references to cxa_atexit or fwalk. Dumping libgideros.a I do see a references to __cxa_atexit so I'm wondering if Gideros didn't register this handler with the NULL callback pointer. Could be Amazon is actually registering the bad callback by another indirect mechanism as well, unsure at this point.
Any help would be appreciated as we want to use AI and I believe this crash will be caught be Apple and cause our submission to be rejected.
Thanks in advance.
PS - tagging
@atilim for his attention
Hardware Model: iPad4,4
Code Type: ARM (Native)
Parent Process: launchd [1]
OS Version: iOS 7.0.4 (11B554a)
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Triggered by Thread: 0
Thread 0 Crashed:
0 ??? 0000000000 0 + 0
1 MyApp 0x000e195d _fwalk (fwalk.c:50)
2 libsystem_c.dylib 0x3aef2879 __cxa_finalize + 149
3 libsystem_c.dylib 0x3aeb25c9 exit + 13
4 UIKit 0x32b0115d -[UIApplication _terminateWithStatus:] + 345
5 UIKit 0x32afe497 -[UIApplication _handleApplicationSuspend:eventInfo:] + 2475
6 UIKit 0x32a7f0c7 -[UIApplication handleEvent:withNewEvent:] + 775
7 UIKit 0x32a7ecfd -[UIApplication sendEvent:] + 73
8 UIKit 0x32ae4321 _UIApplicationHandleEvent + 665
9 GraphicsServices 0x34f2b76d _PurpleEventCallback + 609
10 GraphicsServices 0x34f2b357 PurpleEventCallback + 35
11 CoreFoundation 0x302c0777 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
12 CoreFoundation 0x302c0713 __CFRunLoopDoSource1 + 347
13 CoreFoundation 0x302beedf __CFRunLoopRun + 1407
14 CoreFoundation 0x30229471 CFRunLoopRunSpecific + 525
15 CoreFoundation 0x30229253 CFRunLoopRunInMode + 107
16 GraphicsServices 0x34f2a2eb GSEventRunModal + 139
17 UIKit 0x32ade845 UIApplicationMain + 1137
18 MyApp 0x0000ed9f main (main.m:12)
19 MyApp 0x0000ed28 start + 40 |
Below is another perhaps related call stack I've seen which has a similar call through _fwalk but crashes later on.
Hardware Model: iPad4,4
Code Type: ARM (Native)
Parent Process: launchd [1]
OS Version: iOS 7.0.4 (11B554a)
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Triggered by Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3af406e4 __kill + 8
1 MyApp 0x000662c9 ___lldb_unnamed_function1765$$MyApp + 193
2 libsystem_platform.dylib 0x3afa3721 _sigtramp + 41
3 MyApp 0x0007fa2d __sflush (fflush.c:79)
4 MyApp 0x000806fb _fwalk (fwalk.c:50)
5 libsystem_c.dylib 0x3aef2877 __cxa_finalize + 147
6 libsystem_c.dylib 0x3aeb25c5 exit + 9
7 UIKit 0x32b01159 -[UIApplication _terminateWithStatus:] + 341
8 UIKit 0x32afe493 -[UIApplication _handleApplicationSuspend:eventInfo:] + 2471
9 UIKit 0x32a7f0c3 -[UIApplication handleEvent:withNewEvent:] + 771
10 UIKit 0x32a7ecf9 -[UIApplication sendEvent:] + 69
11 UIKit 0x32ae431d _UIApplicationHandleEvent + 661
12 GraphicsServices 0x34f2b76b _PurpleEventCallback + 607
13 GraphicsServices 0x34f2b353 PurpleEventCallback + 31
14 CoreFoundation 0x302c0775 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 33
15 CoreFoundation 0x302c070f __CFRunLoopDoSource1 + 343
16 CoreFoundation 0x302beedb __CFRunLoopRun + 1403
17 CoreFoundation 0x3022946d CFRunLoopRunSpecific + 521
18 CoreFoundation 0x3022924f CFRunLoopRunInMode + 103
19 GraphicsServices 0x34f2a2e7 GSEventRunModal + 135
20 UIKit 0x32ade841 UIApplicationMain + 1133
21 MyApp 0x0001db53 main (main.m:12)
22 MyApp 0x0001db04 ___lldb_unnamed_function1$$MyApp + 36 |
Comments
Does it make any sense to you?
1. Open Gideros Studio
2. New Project
3. Add New File...->init.lua
4. Add print("") to init.lua
5. Export project to iOS
6. Open exported project in XCode 5.0.2
7. Run project on a real device using iOS 7 (I'm using an iPad Mini Retina or iPhone 5s)
8. Once app appears on device double click home button.
9. Slide up on app to close
Expected : Clean shutdown
Actual : Crash in _fwalk in XCode
I've attached my project that repro's this every time. In the mean time I'm setting print = function() end in my product app to get around this crash.