Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26098] iOS: Simulator randomly crashes during Ti.Buffer "toBlob()" test

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterHans Knöchel
AssigneeUnknown
Created2018-06-05T22:00:42.000+0000
Updated2018-06-05T22:15:33.000+0000

Description

We recently updated the Ti.Buffer API to be more comprehensive and tested. In a recent PR, I now noticed a crash occurring when calling "toBlob" on a Ti.Buffer instance (crash log attached). It looks like it instantiates a Ti.Blob successfully, but it then gets deallocated too early and crashes with a bad access. This might either be related to [this change](https://github.com/appcelerator/titanium_mobile/commit/38f9ebcc506f9b5275ea9a032794fd66c6cb4502#diff-cf2c45a6e64c734d0a5fc57a971170d7R309) from 2 years ago or from [this change](https://github.com/appcelerator/titanium_mobile/pull/10028) a few months ago. I feel it might even have happened before these two, but haven't been surfaced before [~cwilliams] added the unit tests for it.

Attachments

FileDateSize
mocha_2018-05-31-162329_curlywurly-macos.crash2018-06-05T22:06:21.000+0000166692

Comments

  1. Hans Knöchel 2018-06-05

    A quick stress test does not trigger the crash (30+ runs):
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var btn = Ti.UI.createButton({
           title: 'Trigger'
       });
       
       btn.addEventListener('click', function() {
           var win2 = Ti.UI.createWindow({ backgroundColor: 'red' });
           win2.addEventListener('open', function () {
               var blob;
       
               // just a simple ascii string
               var buffer = Ti.createBuffer({
                   length: 12
               });
               buffer[0] = 97; // a
               buffer[1] = 112; // p
               buffer[2] = 112; // p
               buffer[3] = 99; // c
               buffer[4] = 101; // e
               buffer[5] = 108; // l
               buffer[6] = 101; // e
               buffer[7] = 114; // r
               buffer[8] = 97; // a
               buffer[9] = 116; // t
               buffer[10] = 111; // o
               buffer[11] = 114; // r
           
               Ti.API.info(buffer.toString());
           
               blob = buffer.toBlob();
               Ti.API.info('BLOB LENGTH = ' + blob.length + ', BUFFER LENGTH = ' + buffer.length);
               Ti.API.info(blob.text);
       
               setTimeout(function () {
                   win2.close();
               }, 1000);
           });
       
           win2.open();
       });
       
       win.add(btn);
       win.open();
       

JSON Source