[TIMOB-27080] iOS: Memory leak and deadlock in SDK 8+
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-06-17T18:21:06.000+0000 |
Affected Version/s | Release 8.0.0, Release 8.1.0 |
Fix Version/s | Release 8.0.2 |
Components | iOS |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Christopher Williams |
Created | 2019-05-14T13:43:43.000+0000 |
Updated | 2019-06-17T18:21:06.000+0000 |
Description
This is the follow-up ticket of TIMOB-27053. That ticket fixed some critical issues in regards to JSCore crashes, but now we still see *a lot* (on older iPhones every time) dead locks that cause the app to freeze and crash later. The worst thing is that those logs also do not show up on Crashlytics, so cannot know exactly where it crashes, although I assume it is JSCore as well.
Notable is that before every crash, it shows the following warning:
[DEBUG] Firing app event: memorywarning
As discussed with [~jvennemann], this is likely the reason why it crashes - a deadlock in firing the event. Unfortunately he was not able to provide a workaround or fix to test so far, so we are escalating this ticket now.
[~hknoechel] It looks like you have a listener on this event in your app? If you add some logging at the beginning/end of that listener do you see that it gets fired and finishes? The log certainly lets us know the app is getting
didReceiveMemoryWarning:
called, but it doesn't really narrow it down to whether there's a deadlock in firing the event to listeners in JS, or if it happens to get as far as firing to the listeners but never returns, or does finish firing and hangs/crashes later on (in native SDK code on this or other proxies). I also assume that TIMOB-26967 may be leading this to occur much more frequently on production/device builds not under the CLI.Hey Chris! We are currently updating our fork with the logger fixes and will report soon. Independently, you can trigger the memory warning deadlock by triggering it from the iOS Simulator menu setting "Simulate memory warning" which will freeze the app immediately.
Assigning to Jan as per discussion in standup, sounds like he may have an idea where this is happening.
You were right [~jvennemann], that busy loop was definitely the cause. master: https://github.com/appcelerator/titanium_mobile/pull/10893 8_0_X: https://github.com/appcelerator/titanium_mobile/pull/10894
Merged manually to 8_0_X, 8_1_X and master.
Verified on: Mac OS 10.14.3 Ti SDK: 8.0.2.v20190617094142 Appc CLI: 7.0.11 Node: 10.13.0 JDK: 1.8.0_144 XCode: 10.2.1 iOS Device: iPhone 6s (v12.1.4)