{ "id": "62931", "key": "TIMOB-2299", "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": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:58:41.000+0000", "created": "2011-04-15T03:16:02.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "asihttp", "critical", "defect", "ios", "leak", "memory", "proxy", "release-1.6.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:58:41.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": "{html}

Looks like some ASI objects are not released. Running the\nfollowing test in instruments revealed that no ASIFormDataRequest\nobjects are ever deallocated:

\n
\nvar count = 0;\nfunction runXHR(){\n    var xhr = Titanium.Network.createHTTPClient();\n\n    xhr.onload = function()\n    {\n        count++;\n        Ti.API.log('available memory:' + Titanium.Platform.availableMemory + ' cnt: ' + count);\n    };\n    // open the client\n    xhr.open('GET','http://www.developedit.com/test.json');\n\n    // send the data\n    xhr.send();\n}\n\nrunXHR();\n\nsetInterval(function()\n{\n    runXHR();\n},1000);\n
{html}", "attachment": [], "flagged": false, "summary": "Some ASI objects leaked", "creator": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "128075", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [6e72cfc6d42fc819ccb2632b7ea90f777c3c6307])\n[#2299 state:open] Fixes to set appropriate\nvalues. Resetting bug to open because this actually has to do with\nindefinite proxy retention; see bug for details. \nhttps://github.com/appcelerator/titanium_mobile/commit/6e72cfc6d42f...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:02.000+0000", "updated": "2011-04-15T03:16:02.000+0000" }, { "id": "128076", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Very bad news; this is an endemic problem throughout Titanium,\nthe dreaded \"proxy retention issue.\" This is because we retain\nproxies as part of contexts, and then NEVER release them until the\ncontext is closed. This is especially bad for HTTP requests, as we\nreturn response information in the proxy - that means that over\ntime huge amounts of cruft may accumulate, even with just a few\n(expensive) HTTP requests.

\n

Marking this bug CRITICAL even though it may\nnot be completed before 1.5.0.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:03.000+0000", "updated": "2011-04-15T03:16:03.000+0000" }, { "id": "128077", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [93f5ab4b4fb667df89641cf97b7495321ee5b02b])\n[#2299] Minor fix to handle some crashers.\n\nhttps://github.com/appcelerator/titanium_mobile/commit/93f5ab4b4fb6...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:03.000+0000", "updated": "2011-04-15T03:16:03.000+0000" }, { "id": "128078", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [c499a6e69be9895cce1cf02741b90f679ea34c87])\n[#2299 state:fixed-in-qa] Closer conformance to\nXHR and plugging of memory leak. \nhttps://github.com/appcelerator/titanium_mobile/commit/c499a6e69be9...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:03.000+0000", "updated": "2011-04-15T03:16:03.000+0000" }, { "id": "128079", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

How did that last commit just get discovered? It was made before\nthe first one, and... well, who cares. Reopening the bug.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:03.000+0000", "updated": "2011-04-15T03:16:03.000+0000" }, { "id": "128080", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Bumping this down the road, with a note. It's two-pronged: Proxy\nretention issues (how we handle memory warnings is not smart right\nnow, because it LEADS to memory warnings) and problems in Kroll\ninvolving certain objects which should be autoreleased (but never\nare, because they're retained at very bad points in their\nlifecycle).

\n

Unfortunately at this time there's no good way to handle\nclearing out stale client responses, simply because there's no good\nway to tell when they're \"stale.\"

\n

This bug should be a high priority target for a\n1.5.1 release due to its critical nature.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:03.000+0000", "updated": "2011-04-15T03:16:03.000+0000" }, { "id": "128081", "author": { "name": "damienelmes", "key": "damienelmes", "displayName": "Damien Elmes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Sound objects don't get released until they're explicitly\n.release()d - could a similar approach be taken with ASI, at least\nas a stop gap?

{html}", "updateAuthor": { "name": "damienelmes", "key": "damienelmes", "displayName": "Damien Elmes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:04.000+0000", "updated": "2011-04-15T03:16:04.000+0000" }, { "id": "128082", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Possibly. Let me know if doing \"this.release()\" inside of your\nonload callbacks helps alleviate memory problems. This will not\nrelease the ASI request, but rather the ASI response (you will have\nto release your XHR objects separately).

\n

There may be a stopgap measure put in place to handle ASI\nresponse memory management, but it will not take care of ASI\nrequest retention.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:04.000+0000", "updated": "2011-04-15T03:16:04.000+0000" }, { "id": "128083", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [eb3656b0297a2a28a4b394cd505311415bac7d14])\n[#2299 state:fixed-in-qa] - Don't retain HTTP\nresponses as if they're normal proxies - Cleanup to not use\n'connected' to detect an error vs. success when sending responses;\nwas leading to a race condition that would cause reused HTTP\nclients to stall - Fix for bad juju of separate alloc and init\ncalls in TiModule \nhttps://github.com/appcelerator/titanium_mobile/commit/eb3656b0297a...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:05.000+0000", "updated": "2011-04-15T03:16:05.000+0000" }, { "id": "128084", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Bug #2616 deals with the memory management issues\ndescribed earlier in this bug ticket.

\n

Bug #2617 deals with XHR compliance in general.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:05.000+0000", "updated": "2011-04-15T03:16:05.000+0000" }, { "id": "128085", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

closing this record while noting the 2 open issues Stephen\nlists.

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:05.000+0000", "updated": "2011-04-15T03:16:05.000+0000" }, { "id": "128086", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

should actually close it maybe

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:16:05.000+0000", "updated": "2011-04-15T03:16:05.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }