Crash when "GPU Frame Capture" is enabled in Scheme
| Originator: | raise.rescue | ||
| Number: | rdar://32533929 | Date Originated: | June 2 2017, 2:19 PM |
| Status: | Open | Resolved: | |
| Product: | Product Version: | ||
| Classification: | Crash | Reproducible: |
Summary: We observed a crash in our app under certain circumstances: - It only happens when the app is started from Xcode. - It only happens on devices, not in the simulator. - It only happens in Release-mode. - It only happens when "Debug executable" is turned on in the scheme. - "Launch" has to be set to "Automatically" in the scheme. - "GPU Frame Capture" has to on "Automatically Enabled". - OpenGLES.framework has to be linked to the app. - None of the memory-analyzing options (Address Sanitizer, Malloc Scribble, Malloc Guard Edges, Guard Malloc, Zombie Objects or Malloc Stack) has to be enabled. The stacktraces varied and didn't guide us to an error in our sourcecode (I attach screenshots of some of them to this issue). It looks like that the memory gets somewhere corrupted, that something writes to an address it shouldn't do and corrupts active objects. In ~1 out of 50 cases, the crash happens at the same point within the app, but at that 50th case, it crashes somewhere random in the app. So the guess was that the corruption hits most often an object that was currently created, and used within the same viewcontroller, and sometimes it just hits an object that is used by an other viewcontroller. Not being able to reproduce the problem with any of the memory-analyzing-options turned on, didn't make it easier. Nevertheless, we assumed that the error was in one of the changes we did in our app and selectively reverted / outcommented code to find the line that causes the crash. This guided us to a call to [[NSRunLoop currentRunLoop] runUntilDate:] inside SVProgressHUD - when we outcommented it, it didn't crash. But this didn't make any sense at all. Before that call, views, layers and animations are created. So we assumed that it might be related to animations that start to get visible while the runloop gets started, and then the method which calls runUntilDate finishes and the autoreleasepool kicks in and something terrible happens. But deactivating almost all of that code didn't made the crash to go away. So, on the third day of debugging, today, I switched the available options in the Scheme on / off just out of curiousity. So I first found out that it only happens when "Debug executable" is turned on, and it also only happens when "Launch" is set to "Automatically". Seems like that an active debugging-session alters the behaviour of the app. Reactivating the "Debug exectuable" and setting "Launch" back to "Automatically", I finally turned the "GPU Frame Capture"-option from its default-value "Automatically Enabled" to "Disabled" and that made the crash also disappear. I tried it in an test-project that I created before to make a reduced test-case and noticed that the "FPS"-Gauge only appears when the OpenGLES.framework is linked to the app and concluded that the "GPU Frame Capture"-setting also is only active when the OpenGLES.framework is linked to the app. (continue in "Steps to Reproduce") Steps to Reproduce: As i only have 3000 characters for the Summary, here the continuation: After linking it to the test-app, I was able to reproduce the crash in it (the project is also attached to this issue). We conclude that "GPU Frame Capture" alters the behaviour of the app in a way that may corrupt the memory or cause an undefined state somewhere in iOS that may crash an App. We further conclude that there is no bug in our code and that appstore-releases won't be affected by it. As all of this is purely based on observations and not backed by the knowledge of the real cause, it would be great to hear back if you can confirm our conclusions. Reproduce: 1. Start the attached project on a device. 2. Tap the "Scroll"-button 3. Wait until the progress-hud disappears 4. Repeat step 2 and 3 until the app crashes (normally happens within the first 10 tries) Expected Results: Enabling "GPU Frame Capture" crashes the app. Observed Results: Enabling "GPU Frame Capture" should not cause an app to crash. Version: Notes: Configuration: Observed on iPad Mini 1gen with iOS 9.3.5, iPad 4 with iOS 10.3.2, iPad 4 with iOS 10.3.3 Dev Beta 1
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!