{ "id": "84466", "key": "TIMOB-6985", "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": "12094", "description": "", "name": "Sprint 2012-02", "archived": true, "released": true, "releaseDate": "2012-01-29" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-01-23T16:50:30.000+0000", "created": "2012-01-04T13:12:55.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "xml,", "xmlparsing" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [], "assignee": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-01-23T16:50:30.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": "We load a XML feed that has 400+ elements. Each has about 5 child nodes with numbers or a title, not much data.\r\n\r\nLooping over this XML, and converting it to JS randomly causes strange issues.\r\n\r\nFirst we get the element list using xmlDom.documentElement.getElementsByTagName('nodeName'), which works every time.\r\n\r\nThen we loop over those nodes, and for each child, we get the various sub node values we want and convert them to a JS object.\r\n\r\nDuring this loop, the current node value will randomly change from a TiDOMElement to either null, Object or TiDOMNodeList.\r\nNon of these are valid nodes, and thus subsequent node operations fail.\r\n\r\nThe next iteration of the XML list will work fine.\r\n\r\n\r\n\r\nthe function parseXML in the example file is passed the XHR responseXML object.\r\n\r\nIn the retrieveNodeValue( nodeName, xmlNode) method, suddenly one of the calls the xmlNode passed in is null, Object or TiDOMNodeList - Not a NODE. All calls after this in the current loop will be the same,and then the next loop iteration it works fine.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "attachment": [ { "id": "24946", "filename": "crash during parsing.rtf", "author": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-05T17:06:57.000+0000", "size": 1858, "mimeType": "text/rtf" }, { "id": "24926", "filename": "example.js", "author": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-04T13:12:56.000+0000", "size": 1165, "mimeType": "text/javascript" }, { "id": "24945", "filename": "failed to parse in loop.rtf", "author": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-05T17:06:57.000+0000", "size": 25001, "mimeType": "text/rtf" }, { "id": "24944", "filename": "XML Load Issues (1).zip", "author": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-05T17:06:57.000+0000", "size": 1587870, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: When Parsing large amounts of XML and referencing nodes, randomly a node will either be nulled, or change type!!", "creator": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aleard", "key": "aleard", "displayName": "Alan Leard", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "OSX Lion\r\nIOS for iPhone (5.0)\r\n\r\nTi SDKs tested 1.8.0.1 RC3 and 1.8.0.1 release.", "comment": { "comments": [ { "id": "178088", "author": { "name": "mattbryson", "key": "mattbryson", "displayName": "Matt Bryson", "active": true, "timeZone": "Europe/London" }, "body": "It was suggested that we use the responseText and parse it manually, (http://pastie.org/private/yrbidrdttmhxjpncrgxjpa) but that fails as well.\r\n\r\nI will upload an example project, and logs files so you can easily reproduce.\r\n\r\n", "updateAuthor": { "name": "mattbryson", "key": "mattbryson", "displayName": "Matt Bryson", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-05T04:17:39.000+0000", "updated": "2012-01-05T04:17:39.000+0000" }, { "id": "178316", "author": { "name": "mattbryson", "key": "mattbryson", "displayName": "Matt Bryson", "active": true, "timeZone": "Europe/London" }, "body": "The attached XML Load Issues Zip is a project that you can run to reproduce the issue - it's built following the common js approach.\r\n\r\n\r\nIf you run the app, press the load button and watch the logs for output, you will see that half way through parsing, the XML node we are working on will either be nulled (which usually causes crashes), or changes type as mentioned in the post.\r\n\r\nIt appears to fail about 1 in 5 loads. The feed we are loading is this : http://www.tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml – It updates once every 3 mins.\r\n\r\nIf the data is loaded as the app boots, that causes a lot of instant crashes.\r\n\r\nWhen it does fail, the feed is still valid.\r\n\r\n\r\nI have attached two log files, one where it crashed, and one where it works, but some of the nodes fail to parse.\r\n\r\nIn the Failed to Parse in Loop file, the two points of interest are: (our errors)\r\n\r\n\r\n[INFO] about to convert XML node to JS node number 6\r\n[INFO] about to convert XML node to JS node number 7\r\n[INFO] about to convert XML node to JS node number 8\r\n{color:red} [ERROR] Retreiving Node name lat failed on XML object. XML object is [object Object]\r\n[ERROR] Retreiving Node name long failed on XML object. XML object is [object Object]\r\n[ERROR] Retreiving Node name nbBikes failed on XML object. XML object is [object Object]\r\n[ERROR] Retreiving Node name nbDocks failed on XML object. XML object is [object Object]\r\n{color}\r\n[INFO] about to convert XML node to JS node number 9\r\n[INFO] about to convert XML node to JS node number 10\r\n[INFO] about to convert XML node to JS node number 11\r\n\r\n\r\nYou see here that on node 8 of 400, the 'lat' XML node failed to be retrieved (as the TiDOMElement is reporting to be an Object Object).\r\nThe subsequent child node lookups on this XML node fail (long, nbBikes, nbDocks).\r\n\r\nThen the next iteration, 9, works fine.\r\n\r\n\r\nLater, and this might be relevant, the log gets messed up.\r\n\r\n[INFO] about to convert XML node to JS node number 213\r\n[INFO] about to convert XML node to JS node number 214{color:red} \r\n[INFO] about to convert XM[ERROR] Retreiving Node name nbEmptyDocks failed on XML object. XML object is [object Object]\r\nL node to JS node number 215{color}\r\n[INFO] about to convert XML node to JS node number 216\r\n[INFO] about to convert XML node to JS node number 217\r\n\r\n\r\n214 (or 215?) Fails for the same reason, but the log for 215 is mixed up with it. Not sure if this is an error with the loggin, or this could in some way indicate whats going on.\r\n\r\nIt looks like the xml node we are working with is some how getting overwritten with other data – but you can see from the JS that this isn't possible from the JS side of things.\r\n\r\n\r\nWith the log where it crashed, Ti just reported this\r\n\r\n\r\n[INFO] One moment, building ...\r\n[INFO] Titanium SDK version: 1.8.0.1 (12/22/11 13:09 fbdc96f)\r\n[INFO] iPhone Device family: iphone\r\n[INFO] iPhone SDK version: 5.0\r\n[INFO] iPhone simulated device: iphone\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (2.99 seconds)\r\n[INFO] Found 5.0 patch installed\r\n[INFO] Application started\r\n[INFO] XML Load Issues/1.0 (1.8.0.1.fbdc96f)\r\n[INFO] Application has exited from Simulator\r\n", "updateAuthor": { "name": "mattbryson", "key": "mattbryson", "displayName": "Matt Bryson", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-06T02:56:41.000+0000", "updated": "2012-01-06T02:56:41.000+0000" }, { "id": "178317", "author": { "name": "mattbryson", "key": "mattbryson", "displayName": "Matt Bryson", "active": true, "timeZone": "Europe/London" }, "body": "Also, If you load the data as the app starts, it often crashes (at least in the simulator, not tried on device).\r\nIf the load is user driven, or delay by a second, then it doesn't crash.", "updateAuthor": { "name": "mattbryson", "key": "mattbryson", "displayName": "Matt Bryson", "active": true, "timeZone": "Europe/London" }, "created": "2012-01-06T03:49:29.000+0000", "updated": "2012-01-06T03:49:29.000+0000" }, { "id": "178466", "author": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "body": "Matt, \r\n\r\nDoes this occur on a device as well?\r\n", "updateAuthor": { "name": "sfeather", "key": "sfeather", "displayName": "Stephen Feather", "active": true, "timeZone": "America/New_York" }, "created": "2012-01-08T09:03:13.000+0000", "updated": "2012-01-08T09:03:13.000+0000" }, { "id": "179155", "author": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-12T18:30:18.000+0000", "updated": "2012-01-12T18:30:18.000+0000" }, { "id": "179156", "author": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "body": "In agreement with the author, this issue is only affecting iOS on the emulator or on the device. This has not affected Android builds of the same exact app. \r\n\r\nAlso as a complete shot in the dark (based on the date where the error cropped up) I was wondering if these fixes in the CI builds may be a source or related in some way: https://github.com/appcelerator/titanium_mobile/commit/bc6b5fce413c73bc0fb094c301b738dc75e01bcc and https://github.com/appcelerator/titanium_mobile/commit/364165a8345b968c03477a09cf9081f7b5f67381\r\n\r\nTotal shot in the dark", "updateAuthor": { "name": "ch", "key": "ch", "displayName": "Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-12T18:33:20.000+0000", "updated": "2012-01-12T18:33:20.000+0000" }, { "id": "179851", "author": { "name": "apsylone", "key": "apsylone", "displayName": "Benjamin Jeanjean", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This affect Ti SDK 1.7.X as well.", "updateAuthor": { "name": "apsylone", "key": "apsylone", "displayName": "Benjamin Jeanjean", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-19T01:42:42.000+0000", "updated": "2012-01-19T01:42:42.000+0000" }, { "id": "180176", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as Fixed.\r\nSDK: 1.9.0.v20120121223134, 1.8.0.1.v20120119133134\r\nStudio: 1.0.8.201201190907\r\nOS: Lion\r\nDevices Tested: iPhone 5.0", "updateAuthor": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-23T10:41:52.000+0000", "updated": "2012-01-23T10:41:52.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }