Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27080] iOS: Memory leak and deadlock in SDK 8+

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2019-06-17T18:21:06.000+0000
Affected Version/sRelease 8.0.0, Release 8.1.0
Fix Version/sRelease 8.0.2
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeChristopher Williams
Created2019-05-14T13:43:43.000+0000
Updated2019-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.

Comments

  1. Christopher Williams 2019-05-15

    [~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.
  2. Hans Knöchel 2019-05-15

    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.
  3. Christopher Williams 2019-05-15

    Assigning to Jan as per discussion in standup, sounds like he may have an idea where this is happening.
  4. Christopher Williams 2019-05-15

    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
  5. Christopher Williams 2019-06-17

    Merged manually to 8_0_X, 8_1_X and master.
  6. Satyam Sekhri 2019-06-17

    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)

JSON Source