{ "id": "170995", "key": "MOD-2396", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2018-07-23T10:22:56.000+0000", "created": "2018-01-29T10:12:56.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-07-23T10:22:56.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14565", "name": "TouchID" } ], "description": "(Moved from [Github|https://github.com/appcelerator-modules/titanium-identity/issues/8])\r\n\r\nThere seems to be a stability issue with the module on iOS. We are testing this for one of Axway's enterprise clients, and about 20% of the time it crashes the entire app after processing a user's Face ID.\r\n\r\nWe are on the latest everything...AppC 7.0, etc...\r\n\r\nHere are some details of the crashes:\r\n\r\nException Type: EXC_BAD_ACCESS (SIGSEGV)\r\n\r\nThread 13 Crashed:\r\n0 libobjc.A.dylib \t0x00000001807a81a0 objc_retain + 16\r\n1 Jason's Deli \t0x0000000102a24568 0x102544000 + 5113192\r\n2 libdispatch.dylib \t0x0000000180ec1088 _dispatch_call_block_and_release + 24\r\n3 libdispatch.dylib \t0x0000000180ec1048 _dispatch_client_callout + 16\r\n4 libdispatch.dylib \t0x0000000180efc4e0 _dispatch_queue_override_invoke$VARIANT$armv81 + 700\r\n5 libdispatch.dylib \t0x0000000180f02418 _dispatch_root_queue_drain + 564\r\n6 libdispatch.dylib \t0x0000000180f02180 _dispatch_worker_thread3 + 112\r\n7 libsystem_pthread.dylib \t0x0000000181167120 _pthread_wqthread + 1268\r\n8 libsystem_pthread.dylib \t0x0000000181166c20 start_wqthread + 4\r\n\r\n----------------------------------------------------------------------------\r\n\r\n\r\nException Type: EXC_BAD_ACCESS (SIGSEGV)\r\n\r\nThread 12 Crashed:\r\n0 JavaScriptCore \t0x0000000187f0cf98 JSC::speculationFromStructure+ 659352 (JSC::Structure*) + 0\r\n1 JavaScriptCore \t0x0000000188114d4c JSC::CodeBlock::updateAllPredictionsAndCountLiveness+ 2788684 (unsigned int&, unsigned int&) + 352\r\n2 JavaScriptCore \t0x0000000188111678 JSC::CodeBlock::UnconditionalFinalizer::finalizeUnconditionally+ 2774648 () + 36\r\n3 JavaScriptCore \t0x00000001883e5d4c JSC::Heap::runEndPhase+ 5741900 (JSC::GCConductor) + 1584\r\n4 JavaScriptCore \t0x00000001883e4368 JSC::Heap::runCurrentPhase+ 5735272 (JSC::GCConductor, JSC::CurrentThreadState*) + 220\r\n5 JavaScriptCore \t0x00000001883e944c JSC::Heap::Thread::work+ 5755980 () + 32\r\n6 JavaScriptCore \t0x0000000188784c38 WTF::Function::CallableWrapper::call+ 9538616 () + 360\r\n7 JavaScriptCore \t0x0000000187e75660 WTF::threadEntryPoint+ 38496 (void*) + 120\r\n8 JavaScriptCore \t0x0000000187e755a0 WTF::wtfThreadEntryPoint+ 38304 (void*) + 84\r\n9 libsystem_pthread.dylib \t0x000000018116831c _pthread_body + 308\r\n10 libsystem_pthread.dylib \t0x00000001811681e8 _pthread_body + 0\r\n11 libsystem_pthread.dylib \t0x0000000181166c28 thread_start + 4\r\n\r\n\r\nWe have a workaround or maybe it's just a best practice implementation that resolves these crashes on iOS. Basically you can't create a new keychain item for each use, instead you have to create a singleton and handle \"one-time\" event listeners accordingly. On android it works fine either way.\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: Ti.Identity - Crashes about 20% of the time ", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1053, "state": "closed", "name": "2018 Sprint 15 SDK", "startDate": "2018-07-15T21:52:05.453Z", "endDate": "2018-07-29T21:52:00.000Z", "completeDate": "2018-07-29T22:25:11.723Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "433800", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~btknorr] Let's tackle this! A few questions:\r\n* When authorizing the keychain item, does this only happen with Face ID or does it with Touch ID as well?\r\n* Do you have an example code for this (no worries, we can create one if not existing)?\r\n* Is this limited to specific iOS *or* Ti.Identity / Ti.TouchID versions?\r\n\r\nThanks!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-29T15:22:34.000+0000", "updated": "2018-01-29T15:24:39.000+0000" }, { "id": "433850", "author": { "name": "gaspard.le", "key": "gaspard.le", "displayName": "Luc-Edmond Gaspard ", "active": true, "timeZone": "America/Montreal" }, "body": "This code can cause the crash.\r\n\r\n{code:javascript}\r\nvar TiIdentity = require('ti.identity');\r\n\r\nvar win = Ti.UI.createWindow({layout:\"vertical\", backgroundColor:\"white\", top: 30});\r\n\r\n var btnSet = Ti.UI.createButton({title: \"set loop\", bottom:\"10\", borderColor: \"blue\"});\r\n btnSet.addEventListener(\"click\", function(){\r\n\t \tsetInterval(function(){\r\n\t\t\tsetObject(\"testkey\");\r\n\t\t}, 200);\r\n });\r\nwin.add(btnSet);\r\n\r\n var btnGet = Ti.UI.createButton({title: \"get loop\", bottom:\"10\", borderColor: \"blue\"});\r\n btnGet.addEventListener(\"click\", function(){\r\n\t\tsetInterval(function(){\r\n\t\t\tgetObject(\"testkey\");\r\n\t\t}, 200);\r\n });\r\nwin.add(btnGet);\r\n\r\nwin.open();\r\n\r\nfunction createKeyChainItem(key) {\r\n\t\tvar appIdentifierPrefix = \"NCCABCDEFG\";\r\n\t\tvar keychainItem = TiIdentity.createKeychainItem({\r\n\t\t\tidentifier: key,\r\n\t\t\taccessGroup: appIdentifierPrefix + '.' + Ti.App.getId()\r\n\t\t});\r\n\t\treturn keychainItem;\r\n\t}\r\n\r\nfunction getObject(key){\r\n\tvar keychainItem = createKeyChainItem(key);\r\n\tkeychainItem.addEventListener('read', function(e){\r\n\t\tconsole.log(\"get success:\", e.success, \"value:\", e.value);\r\n\t});\r\n\tkeychainItem.read();\r\n}\r\n\r\nfunction setObject(key){\r\n\tvar keychainItem = createKeyChainItem(key);\r\n\tvalExists(keychainItem, function(exists){\r\n\t\tif (exists) {\r\n\t\t\t\tkeychainItem.addEventListener('update', function(e){\r\n\t\t\t\tconsole.log(\"update:\" , e.success);\r\n\t\t\t});\r\n\t\t\t\tkeychainItem.update(\"test123\");\r\n\t\t}else{\r\n\t\t\tkeychainItem.addEventListener('save', function(e){\r\n\t\t\t\tconsole.log(\"save:\" , e.success);\r\n\t\t\t});\r\n\t\t\tkeychainItem.save(\"test123\");\r\n\t\t}\r\n\t});\r\n}\r\n\r\nfunction valExists(keychainItem, callback){\r\n\tkeychainItem.fetchExistence(function(e) {\r\n\t\tTi.API.debug(\"exists: \" + e.exists);\r\n\t\tcallback(e.exists);\r\n\t});\r\n}\r\n{code}", "updateAuthor": { "name": "gaspard.le", "key": "gaspard.le", "displayName": "Luc-Edmond Gaspard ", "active": true, "timeZone": "America/Montreal" }, "created": "2018-01-30T20:02:29.000+0000", "updated": "2018-01-30T20:02:29.000+0000" }, { "id": "433851", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~gaspard.le] In your example, you are creating scoped event listeners without removing them again, which will end of in this behavior. You still need to keep track on which events listeners you add and remove in order to properly work with keychain access on iOS. If only this kind of code is crashing, I do not see an immediate issue with this.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-30T20:22:17.000+0000", "updated": "2018-01-30T20:22:17.000+0000" }, { "id": "433853", "author": { "name": "gaspard.le", "key": "gaspard.le", "displayName": "Luc-Edmond Gaspard ", "active": true, "timeZone": "America/Montreal" }, "body": "Ok I thought they would be removed when the variable become out of scope. But then it still crash if I remove the event listener. \r\n\r\nBut if reuse the same KeyChainItem instance, it does not crash even if I dont remove the listener.", "updateAuthor": { "name": "gaspard.le", "key": "gaspard.le", "displayName": "Luc-Edmond Gaspard ", "active": true, "timeZone": "America/Montreal" }, "created": "2018-01-30T21:01:17.000+0000", "updated": "2018-01-30T21:01:17.000+0000" }, { "id": "434277", "author": { "name": "jonesdhtx", "key": "jonesdhtx", "displayName": "David Jones", "active": true, "timeZone": "America/Chicago" }, "body": "Regarding questions in the initial comment:\r\n1) we experienced the issue with touch id as well\r\n2) we were creating our instance locally too, guessing the GC cleaned up either the keychain item or the handler func before the async callback was made. we should have coded to use a singleton or otherwise keep a reference to the handler and the keychain item until the callback was made\r\n3) we experienced same issue when trying a few different versions of Ti.TouchID and Ti.Identity", "updateAuthor": { "name": "jonesdhtx", "key": "jonesdhtx", "displayName": "David Jones", "active": true, "timeZone": "America/Chicago" }, "created": "2018-02-08T22:48:50.000+0000", "updated": "2018-02-08T22:48:50.000+0000" }, { "id": "438306", "author": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "body": "I'm having a similar issue with touchId, the same crash log.\r\nIf I press the home button before the touch Id alert is displayed, 50% of the time the app crashes without any console log but showing a crash log on the device like this one:\r\nThread 17 name: WTF::AutomaticThread\r\nThread 17 Crashed:\r\n0 JavaScriptCore \t0x0000000187d474b8 0x187ce5000 + 402616\r\n1 JavaScriptCore \t0x0000000187fdfaa4 0x187ce5000 + 3123876\r\n2 JavaScriptCore \t0x0000000187fdb114 0x187ce5000 + 3105044\r\n3 JavaScriptCore \t0x000000018830f034 0x187ce5000 + 6463540\r\n4 JavaScriptCore \t0x0000000188306440 0x187ce5000 + 6427712\r\n5 JavaScriptCore \t0x000000018830a838 0x187ce5000 + 6445112\r\n6 JavaScriptCore \t0x0000000188308b4c 0x187ce5000 + 6437708\r\n7 JavaScriptCore \t0x000000018830e274 0x187ce5000 + 6460020\r\n8 JavaScriptCore \t0x000000018878605c 0x187ce5000 + 11145308\r\n9 JavaScriptCore \t0x00000001887b22e0 0x187ce5000 + 11326176\r\n10 JavaScriptCore \t0x0000000187cf0294 0x187ce5000 + 45716\r\n11 libsystem_pthread.dylib \t0x0000000180d95220 0x180d93000 + 8736\r\n12 libsystem_pthread.dylib \t0x0000000180d95110 0x180d93000 + 8464\r\n13 libsystem_pthread.dylib \t0x0000000180d93b10 0x180d93000 + 2832\r\n\r\nIf I wait a couple of seconds and then press the app never crashes.\r\nI'm not sure what the reason could be and I haven't been able to find a workaround.", "updateAuthor": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "created": "2018-06-11T19:16:15.000+0000", "updated": "2018-06-11T19:16:15.000+0000" }, { "id": "438307", "author": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "body": "Just to be clear, I am not using a keyChainItem, just touchId.authenticate\r\n", "updateAuthor": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "created": "2018-06-11T19:21:44.000+0000", "updated": "2018-06-11T19:21:44.000+0000" }, { "id": "438325", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~inzori] Can you please share your example code? Thanks!", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-12T04:02:25.000+0000", "updated": "2018-06-12T04:02:25.000+0000" }, { "id": "438336", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~inzori] Thanks for the input! As [~vijaysingh] said, your log and a tiny app.js-suitable example would be helpful as well, but I may know what's going on there. And 50 % crash rate should be easy to reproduce.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-12T10:29:44.000+0000", "updated": "2018-06-12T10:29:44.000+0000" }, { "id": "438338", "author": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "body": "I'll try to make an example app and reproduce it, this is happening on a bigger app. All latest versions, including 7.1.1.GA.", "updateAuthor": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "created": "2018-06-12T12:48:46.000+0000", "updated": "2018-06-12T12:48:46.000+0000" }, { "id": "438340", "author": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "body": "I haven't been able to reproduce it on a sample app yet. Maybe this part of the crash log can be of any help.\r\n\r\nIncident Identifier: FD712700-05EF-4899-8392-7F68F8090810\r\nCrashReporter Key: 1e246c1ed050bdf3f0a45a69f48a3071084f1912\r\nHardware Model: iPhone8,1\r\nProcess: Akimbo [2562]\r\nPath: /private/var/containers/Bundle/Application/023C561E-E128-4FC4-8AC3-6CED6AFEDAA4/XXX.app/XXX\r\nIdentifier: com.inzori.xxx\r\nVersion: 9.2.36 (9.2.36)\r\nCode Type: ARM-64 (Native)\r\nRole: Foreground\r\nParent Process: launchd [1]\r\nCoalition: com.inzori.xxx [1124]\r\n\r\n\r\nDate/Time: 2018-06-12 10:55:28.7790 -0300\r\nLaunch Time: 2018-06-12 10:55:19.8275 -0300\r\nOS Version: iPhone OS 11.4 (15F79)\r\nBaseband Version: 4.60.00\r\nReport Version: 104\r\n\r\nException Type: EXC_BAD_ACCESS (SIGSEGV)\r\nException Subtype: KERN_INVALID_ADDRESS at 0x000000000000000d\r\nVM Region Info: 0xd is not in any region. Bytes before following region: 4304338931\r\n REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL\r\n UNUSED SPACE AT START\r\n---> \r\n __TEXT 00000001008f0000-0000000100f14000 [ 6288K] r-x/r-x SM=COW ...xx.app/XXX\r\n\r\nTermination Signal: Segmentation fault: 11\r\nTermination Reason: Namespace SIGNAL, Code 0xb\r\nTerminating Process: exc handler [0]\r\nTriggered by Thread: 16\r\n", "updateAuthor": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "created": "2018-06-12T14:04:35.000+0000", "updated": "2018-06-12T14:04:35.000+0000" }, { "id": "438342", "author": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "body": "I was able to fix the issue. The app had the touchId authentication on the windows open event and on a click event of a hidden label (never used, old code). After removing the click event of the label the app stopped crashing. Don't know the reason of the crashes though.", "updateAuthor": { "name": "inzori", "key": "inzori", "displayName": "Fabian Martinez", "active": true, "timeZone": "America/Montevideo" }, "created": "2018-06-12T14:58:05.000+0000", "updated": "2018-06-12T14:58:05.000+0000" }, { "id": "439404", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks [~inzori], happy to hear that! Resolving the issue as we haven't been able to reproduce it and you solved it as well. Thx!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-07-23T10:22:56.000+0000", "updated": "2018-07-23T10:22:56.000+0000" } ], "maxResults": 17, "total": 17, "startAt": 0 } } }