{ "id": "175427", "key": "AC-6584", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": null, "resolutiondate": null, "created": "2020-08-11T13:47:41.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-08-11T13:47:41.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "*Summary*\r\n\r\nWe're using ti.identity to store a user token in the iOS keychain, this goes well most of the time, but sometimes (about 7% of the time according to Firebase) an exception will occur:\r\n\r\n{code:java}\r\nCrashed: com.apple.root.default-qos\r\nEXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000020\r\n__26-[APSKeychainWrapper read]_block_invoke\r\n\r\n0 libobjc.A.dylib 0x1aec3bbf0 objc_retain + 16\r\n1 MyApp 0x10092b284 __26-[APSKeychainWrapper read]_block_invoke + 111 (APSKeychainWrapper.m:111)\r\n2 libdispatch.dylib 0x1af488a38 _dispatch_call_block_and_release + 24\r\n3 libdispatch.dylib 0x1af4897d4 _dispatch_client_callout + 16\r\n4 libdispatch.dylib 0x1af42dc80 _dispatch_queue_override_invoke + 684\r\n5 libdispatch.dylib 0x1af43a030 _dispatch_root_queue_drain + 372\r\n6 libdispatch.dylib 0x1af43a8d4 _dispatch_worker_thread2 + 128\r\n7 libsystem_pthread.dylib 0x1af66a1b4 _pthread_wqthread + 464\r\n8 libsystem_pthread.dylib 0x1af66ccd4 start_wqthread + 4\r\n{code}\r\n\r\n*Step to reproduce*\r\n\r\n# Add the example code to a Titanium classic project\r\n# Add the ti.identity module\r\n# Run the app on iOS and wait until the app crashes (usually within a couple of minutes)\r\n\r\nNOTE: the actual app doesn't loop to update the KeychainItem, this is just an example.\r\n\r\n{code:java}\r\nvar TiIdentity = require('ti.identity');\r\n\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff',\r\n});\r\n\r\nvar countLabel = Ti.UI.createLabel({\r\n width: Ti.UI.FILL,\r\n textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,\r\n});\r\nwin.add(countLabel);\r\n\r\nfunction updateKeychainItem(value, onResult) {\r\n var keychainItem = TiIdentity.createKeychainItem({\r\n identifier: 'password',\r\n });\r\n\r\n keychainItem.fetchExistence(function (eExistence) {\r\n if (eExistence.exists) {\r\n keychainItem.addEventListener('read', function (eRead) {\r\n if (!eRead.success) {\r\n onResult(eRead);\r\n return;\r\n }\r\n\r\n if (eRead.value != value) {\r\n keychainItem.addEventListener('update', onResult);\r\n keychainItem.update(value);\r\n } else {\r\n onResult({ success: true });\r\n }\r\n });\r\n keychainItem.read();\r\n } else {\r\n keychainItem.addEventListener('save', onResult);\r\n keychainItem.save(value);\r\n }\r\n });\r\n}\r\n\r\nwin.addEventListener('open', function () {\r\n (function updateLoop(i) {\r\n updateKeychainItem('pass ' + i, function (e) {\r\n if (--i) updateLoop(i);\r\n countLabel.text = i;\r\n });\r\n })(100000);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n*Expected result*\r\n\r\nThe app updates the KeychainItem a 100000 times.\r\n\r\n*Actual result*\r\n\r\nThe app crashes before finishing the loop.", "attachment": [], "flagged": false, "summary": "iOS: ti.identity rare crash when when reading/updating KeychainItem value", "creator": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "teunklijn@telfort.nl", "key": "teunklijn@telfort.nl", "displayName": "Teun Klijn", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": " Ti SDK 9.0.3.GA", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }