Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17142] Android: ListView crashes after using .replaceSectionAt() several times

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2014-09-12T17:24:33.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.4.2, Release 3.5.0
ComponentsAndroid
Labelsandroid, parity
ReporterW. Blaine Price
AssigneePing Wang
Created2014-06-09T19:31:11.000+0000
Updated2017-03-22T23:09:36.000+0000

Description

Issue description

I'm building an amortisation calculator as part of a financial calculator app. Since amortization tables are fairly lengthy, I'm using a ListView with two different versions of the ListView data to simulate a list expansion effect. On itemclick, .replaceSectionAt() is called to replace a section of the summarized list with data from another object. Any open section is replaced again with the summarized version. This is working flawlessly on iOS, but crashes after several clicks on Android 4.4.2. Testing on older Android versions causes an immediate crash. The console returns the error:
[INFO] :   libc: Fatal signal 11 (SIGSEGV) at 0x00000014 (code=1), thread 1334 (KrollRuntimeThr)
The error can be replicated by clicking on "Show more" in the app several times on an Android device. Alloy Sample: https://www.dropbox.com/s/hdsudc0mkiw1fzr/list-view-crash-app.zip

Attachments

FileDateSize
Case2067.zip2014-06-12T19:45:33.000+00004070392
timob17142.zip2014-06-12T18:55:04.000+00003293556

Comments

  1. Ingo Muschenetz 2014-06-12

    [~skypanther] Note last comment. Probably worth taking a quick look.
  2. Tim Poulsen 2014-06-12

    Updated Classic project attached
  3. Tim Poulsen 2014-06-12

    This is not an Alloy issue. First, the customer's project uses Alloy for only the outermost app structure. The ListView is created and manipulated using Classic-style code. Second, I could not get the Case2067.zip app to run on either iOS or Android. So, I re-created a Classic version from the customer's Alloy version. See the timob17142.zip file attached. It runs as expected on iOS. On Android, it crashes with the error as described in this ticket. Errors like "Fatal signal 11 (SIGSEGV) at 0x00000014" usually indicate something is attempting to access an object that doesn't exist or the app is out of memory.
  4. Eduardo Gomez 2014-06-12

    Thanks for sharing your findings, Tim. Updated 'Case2067.zip'. The only difference is "underscore" module usage. Although when its removed the application runs a bit longer, then Fatal signal 11 is thrown. On my testing, while profiling allocations I did notice the memory consumption is too high (nearly 85% is used) on both Classic and Alloy.
  5. Hieu Pham 2014-06-17

    master PR: https://github.com/appcelerator/titanium_mobile/pull/5807
  6. Lokesh Choudhary 2014-08-27

    Tested the attached app timob17142.zip with the SDK having the fix & I still see the error:
       [INFO] :   libc: Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 8248 (KrollRuntimeThr)
       
    Environment: Appc Studio : 3.4.0.201408270900 Ti SDK : 3.4.0.v20140826143313 Mac OSX : 10.9.4 Alloy : 1.5.0-dev CLI - 3.4.0-dev Code Processor: 1.1.1 Android 4.4.4
  7. Eric Merriman 2014-08-28

    Reopening based on Lokesh's comment.
  8. Ping Wang 2014-09-12

    The root reason for this issue is the same as TIMOB-14393. In the project "timob17142.zip", "sectionsAftBk" which is an array of ListSection is not attached to the window. When there is a memory pressure, those ListSection might be get cleaned up by GC. That's why the app crashes. There is a workaround. If you want those ListSection to be kept while the window is open, you can set it as the window property
       index.data = sectionsAftBk;
       
  9. W. Blaine Price 2014-10-20

    Hi Ping, I was able to use your workaround to solve my problem. Thanks for your help! Blaine
  10. Lee Morris 2017-03-22

    Closing ticket as duplicate as the relevant ticket is linked above.

JSON Source