{ "id": "136285", "key": "TIMOB-17704", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "16586", "description": "Release 3.4.2", "name": "Release 3.4.2", "archived": false, "released": true, "releaseDate": "2017-03-11" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-10-22T21:17:56.000+0000", "created": "2014-09-09T15:40:15.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Release-3.4.0", "TCSupportTriage", "ios", "module_network", "qe-manualtest", "release-3.3", "release-3.4.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2014-11-24T23:51:17.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "When using a XHR createHTTPClient the onreadystatechange is called multiple times. This mostly seems to happen on readystate 4. If your app uses a lot of XHR threads this will cause the app to hang and crash. \r\n\r\nLog from test app:\r\n\r\n{quote}\r\n[DEBUG] Application booted in 62.319040 ms\r\n[INFO] readystate: 1\r\n[INFO] readystate: 4\r\n[INFO] size 104874307\r\n[INFO] readystate: 4\r\n[INFO] size 104874307\r\n{quote}\r\n\r\nTest app:\r\n\r\n{code:title=app.js|borderStyle=solid}\r\nvar win = Ti.UI.createWindow({title: 'Demo', tabBarHidden: true, backgroundColor: '#fff'});\r\n\r\nvar button = Titanium.UI.createButton({\r\n title: 'Start',\r\n top: 10,\r\n width: 100,\r\n height: 50\r\n});\r\n\r\nwin.add(button);\r\n\r\nfunction getSize() {\r\n \r\n\t\tvar self = this,\r\n\t xhr = Ti.Network.createHTTPClient({\r\n\t timeout: this.timeout,\r\n\r\n\t\t onreadystatechange: function (e) {\r\n\t\t \tTitanium.API.info(\"readystate: \" + this.readyState);\r\n\t\t if (this.readyState === this.DONE) {\r\n\t\t Titanium.API.info('size ' + parseInt(this.getResponseHeader('Content-Length')));\r\n\r\n\t\t }\r\n\t\t },\r\n\r\n\t\t onerror: function (e) {\r\n\t\t \r\n\t\t }\r\n\t\t});\r\n\t\txhr.open('HEAD', 'http://speedtest.dal05.softlayer.com/downloads/test100.zip');\r\n\t\txhr.send();\r\n}\r\n\r\nbutton.addEventListener('click',function(e)\r\n{\r\n getSize();\r\n});\r\n\r\nwin.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: XHR onreadystatechange called multiple times", "creator": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dlewis23", "key": "dlewis23", "displayName": "Donovan Lewis", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac osx 10.9.4 Maverics Appcelerator Studio, build: 3.4.0.201409032048 Titanium SDK, build:3.4.0.v20140903121714", "closedSprints": [ { "id": 230, "state": "closed", "name": "2014 Sprint 21 SDK", "startDate": "2014-10-13T22:00:57.270Z", "endDate": "2014-10-25T00:00:00.000Z", "completeDate": "2014-10-27T16:33:06.432Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "328349", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Test Case\r\n{code}\r\nvar win = Ti.UI.createWindow({title: 'Demo', tabBarHidden: true, backgroundColor: '#fff'});\r\n \r\nvar button = Titanium.UI.createButton({\r\n title: 'Start',\r\n top: 10,\r\n width: 100,\r\n height: 50\r\n});\r\n \r\nwin.add(button);\r\n \r\nfunction getSize() {\r\n \r\n var self = this,\r\n xhr = Ti.Network.createHTTPClient({\r\n timeout: this.timeout,\r\n \r\n onreadystatechange: function (e) {\r\n if (e.readyState) {\r\n Titanium.API.info('Event readystate: ' + e.readyState+' Object readyState: '+this.readyState);\r\n if (e.readyState === this.DONE) {\r\n Titanium.API.info('size ' + parseInt(this.getResponseHeader('Content-Length'))); \r\n }\r\n } else {\r\n Titanium.API.info(\"readystate: \" + this.readyState);\r\n if (this.readyState === this.DONE) {\r\n Titanium.API.info('size ' + parseInt(this.getResponseHeader('Content-Length')));\r\n }\r\n }\r\n },\r\n \r\n onerror: function (e) {\r\n \r\n }\r\n });\r\n xhr.open('HEAD', 'http://speedtest.dal05.softlayer.com/downloads/test100.zip');\r\n xhr.send();\r\n}\r\n \r\nbutton.addEventListener('click',function(e)\r\n{\r\n getSize();\r\n});\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-10-16T18:43:57.000+0000", "updated": "2014-10-16T18:43:57.000+0000" }, { "id": "328350", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending\r\nmaster - https://github.com/appcelerator/titanium_mobile/pull/6228\r\n3_4_X - https://github.com/appcelerator/titanium_mobile/pull/6229", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-10-16T18:44:39.000+0000", "updated": "2014-10-16T18:44:39.000+0000" }, { "id": "333492", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified fix on:\r\n\r\nMac OSX 10.10.1\r\nAppcelerator Studio, build: 3.4.1.201410281743\r\nTitanium SDK build: 3.5.0.v20141124092514, 3.6.0.v20141124111716\r\nTitanium CLI, build: 3.4.1\r\nAlloy: 1.5.1\r\nXcode 6.1.1 GM Seed\r\niPhone 6 Plus (8.1)\r\nNexus 6 (5.0)\r\n\r\nUsing the test code above ran on both devices and the output is as expected. The readyState property for the event, e, is always unique. On Android the app no longer crashes and it runs as expected.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-11-24T22:27:03.000+0000", "updated": "2014-11-24T22:40:02.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }