[TIMOB-19773] iOS: Sample app crashes on start with SQLite error related to analytics
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2016-08-09T21:35:34.000+0000 |
Affected Version/s | Release 5.1.0 |
Fix Version/s | Release 5.4.0 |
Components | iOS |
Labels | analytics |
Reporter | Fokke Zandbergen |
Assignee | Chee Kiat Ng |
Created | 2015-10-23T06:24:34.000+0000 |
Updated | 2017-11-15T19:57:37.000+0000 |
Description
After a few successful builds to my iPhone 6S the new [3D Touch Sample App](https://github.com/appcelerator-developer-relations/appc-sample-3dtouch) started crashing when launched. The only way to fix it was to remove the app and then redeploy it. Replacing the app with a new build without removing it didn't resolve it.
A full crash log attached, which makes it more clear this is related to our analytics.
Our analytics should me as fool-proof as we can make it. We should catch all exceptions to prevent the app from crashing even though that means analytics is no longer working.
*Console*
-- Start application log -----------------------------------------------------
[DEBUG] Reading stylesheet from: /var/mobile/Containers/Bundle/Application/9A562E87-3A7A-47B9-A9D7-F2B7FD09BFB4/3D Touch.app/stylesheet.plist
[INFO] 3D Touch/1.0.0 (5.1.0.c5877a0)
[DEBUG] Loading: /var/mobile/Containers/Bundle/Application/9A562E87-3A7A-47B9-A9D7-F2B7FD09BFB4/3D Touch.app/app.js, Resource: app_js
[ERROR] Error occurred calling next on a PLSqliteResultSet. SQLite error: 'database disk image is malformed' for 'SELECT * from event_sequence'
[DEBUG] Loading: /var/mobile/Containers/Bundle/Application/9A562E87-3A7A-47B9-A9D7-F2B7FD09BFB4/3D Touch.app/alloy.js, Resource: alloy_js
[ERROR] The application has crashed with an uncaught exception 'PLSqliteException'.
[ERROR] Reason:
[ERROR] occurred calling next on a PLSqliteResultSet. SQLite error: 'database disk image is malformed' for 'SELECT * from event_sequence'
[ERROR] Stack trace:
[ERROR]
[ERROR] 0 CoreFoundation 0x000000018296cf5c <redacted> + 124
[ERROR] 1 libobjc.A.dylib 0x0000000197e5bf80 objc_exception_throw + 56
[ERROR] 2 CoreFoundation 0x000000018296cea4 <redacted> + 0
[ERROR] 3 3D Touch 0x000000010050ed94 3D Touch + 4517268
[ERROR] 4 3D Touch 0x0000000100509628 3D Touch + 4494888
[ERROR] 5 libdispatch.dylib 0x0000000198649770 <redacted> + 16
[ERROR] 6 libdispatch.dylib 0x00000001986549c4 <redacted> + 100
[ERROR] 7 3D Touch 0x0000000100509548 3D Touch + 4494664
[ERROR] 8 3D Touch 0x000000010050a2d0 3D Touch + 4498128
[ERROR] 9 3D Touch 0x000000010050c2bc 3D Touch + 4506300
[ERROR] 10 libdispatch.dylib 0x00000001986497b0 <redacted> + 24
[ERROR] 11 libdispatch.dylib 0x0000000198649770 <redacted> + 16
[ERROR] 12 libdispatch.dylib 0x000000019865575c <redacted> + 864
[ERROR] 13 libdispatch.dylib 0x000000019864d274 <redacted> + 464
[ERROR] 14 libdispatch.dylib 0x0000000198649770 <redacted> + 16
[ERROR] 15 libdispatch.dylib 0x0000000198657bb0 <redacted> + 2140
[ERROR] 16 libdispatch.dylib 0x000000019865734c <redacted> + 112
[ERROR] 17 libsystem_pthread.dylib 0x000000019885d478 _pthread_wqthread + 1092
[ERROR] 18 libsystem_pthread.dylib 0x000000019885d028 start_wqthread + 4
[ERROR] *** Terminating app due to uncaught exception 'PLSqliteException', reason: 'Error occurred calling next on a PLSqliteResultSet. SQLite error: 'database disk image is malformed' for 'SELECT * from event_sequence''
[ERROR] *** First throw call stack:
[ERROR] (0x18296cf5c 0x197e5bf80 0x18296cea4 0x10050ed94 0x100509628 0x198649770 0x1986549c4 0x100509548 0x10050a2d0 0x10050c2bc 0x1986497b0 0x198649770 0x19865575c 0x19864d274 0x198649770 0x198657bb0 0x19865734c 0x19885d478 0x19885d028)
^C
Fokkes-MacBook-Pro:appc-sample-3dtouch fokkezb$ tn iphone-fokke
-- End application log -------------------------------------------------------
Attachments
File | Date | Size |
---|---|---|
3D Touch 23-10-15 07-58.crash | 2015-10-23T06:24:32.000+0000 | 65606 |
[~fokkezb] Are sure sure it is related to analytics and not an error of your models?
It might be the models that somehow caused the database disk to be malformed, but the query showing is form analytics: https://github.com/appcelerator/aps_sdk/blob/0a79bba287b4b9a2cbcca46d584634035db9c49f/ios/support/analytics/APSAnalytics/APSAnalytics.m#L599 The analytics module (and others we might inject) should never cause the app to crash. We should catch this, warn maybe but not crash.
This is extremely serious this is happening in my production app. I am getting phone call around from around the world that they have unsynchronised work and the app will not open for them to synchronise (my app runs offline for the Construction industry). [INFO] : *AppNameRemoved*/4.124.4 (5.0.2.92c2265) [DEBUG] : Loading: /var/mobile/Containers/Bundle/Application/9A26E98C-C9A0-4221-9274-E9ABEC559180/AppNameRemoved.app/app.js, Resource: app_js [ERROR] : The application has crashed with an uncaught exception 'PLSqliteException'. [ERROR] : Reason: [ERROR] : Attempted to access non-NSString * column as NSString *. [ERROR] : Stack trace: [ERROR] : [ERROR] : 0 CoreFoundation 0x000000018621cf48
[~mark.henderson@snagr.co.uk] That issue does not look like the above described one.
Attempted to access non-NSString * column as NSString *
indicates, that you tried to access a value as string although it isn't. Also note, that this issue seems related to 5.1.0, which is not released, yet. But we still want to fix this, can you track this down to a part of your app and provide demo code to reproduce? EDIT: If you use Ti.Database sql (not alloy models as the above issue), please follow [this guide](http://www.dosomethinghere.com/2013/02/20/fixing-the-sqlite-error-the-database-disk-image-is-malformed/) to repair your sqlite database, it has been recommended by the native ios community as well.@Hans, this isn't in my app code, it happens immediately.. This is why I think it is related to this issue. To test I stopped loading my normal window and instead get app.js to load a blank window.. Same problem, immediate crash: - Start application log ----------------------------------------------------- [DEBUG] : Reading stylesheet from: /var/mobile/Containers/Bundle/Application/D8EC395A-ABB6-4C93-ACB4-FAAC20D9BC6E/xxxx.app/stylesheet.plist [DEBUG] :
Alright. Don't get me wrong, we take this of course serious. Can you provide a demo code that only holds the the code that crashes the project? And if is required no code, send the project anyway, along with the exact version you are using. EDIT: Also edited your comment to hide the real app name.
@Hans, Version 5.0.2GA of the SDK. This has happened on one device only. I was in the middle of a presentation, the iPad wasn't being used or connected to an internet connection at the time and it just randomly crashed. It then wouldn't open at all. I am now briefly back at the office before I have to go to another presentation requiring the iPad. I cannot send my business's app code to you, I also cannot get the iPA off this iPad to send to you, or the corrupted analytics.db or whatever SQLite database Appcelerator might use internally. I can imagine this is the end of the road for being able to help my issue any further. As soon as I remove / re-add the app everything will be fine. If this is the same issue that has been happening to clients then they are losing work removing /re-adding.. :(
This issue is killing me. I have numerous clients around the world reporting this issue in my production app. I cannot re-create it as I can't cause the initial crash. I'm convinced it's caused by an Appcelerator analytics db because the app will now continue to crash forever on load. This is the worst thing that can happen as my users now have un-synchronised data that cannot be accessed and a dead app that has to be removed and re-added. I am losing a ton of clients over this. I cannot re-create the issue as I don't know when analytics is called or what is causing the initial crash. One thing to note I am a heavy user of SQLite so perhaps there is an open connection to my database and to the analytics db that causes a clash / issue? I don't think the problem is with my code as when the app is launched there is nothing for quite a few windows that uses SQLite in my app, yet it will forever crash on launch. Is there a way to build the app with no analytics.db or something like that?
I had this exact issue on my personal device as reported with the log output: {noformat} [ERROR] Error occurred calling next on a PLSqliteResultSet. SQLite error: 'database disk image is malformed' for 'SELECT * from event_sequence' {noformat} The app crashed immediately upon launching. I saw the log output and guessed that it was the analytics causing the issue, because I do not have an sqlite db in my app. So I went into tiapp.xml and changed the following line from 'true' to 'false'. {noformat}
Thanks @mdelmarter I had just stumbled upon that, so it's great that it's likely to provide a permanent fix!
PRs here: https://github.com/appcelerator/aps_sdk/pull/283 https://github.com/appcelerator/titanium_mobile/pull/7608
New analytics PR: https://github.com/appcelerator/aps_sdk/pull/286
PRs merged.
This is a really serious issue - I got the same problem with my App on various testing devices with clients. Really stressed me out. I am using Appcelerator Studio build 4.5.0.201602170821 . @mdelmarter you really saved my life - I changed Analytics to false and rebuilt and installed App on the device without having to remove it! Thank you!
Hey AIdeen, the better that it has been fixed. Did you try the latest 5.4.0 build, yet to verify it works now?
Attempted to recreate the crash, but was unable to do so, even after 20 launch attempts. [~aideengibson@yahoo.co.uk] are you able to verify whether the latest 5.4.0 build has fixed the issue? it would be greatly appreciated to receive your feedback. Tested On: iPhone 6S (9.3.3) Device & iPhone 6 Plus (8.3) Device Mac OSX El Capitan 10.11.6 Ti SDK: 5.4.0.v20160804185318 Appc Studio: 4.7.0.201607250649 Appc NPM: 4.2.7 App CLI: 5.4.0-40 Xcode 7.3.1 Node v4.4.7
Closing this ticket as unable to reproduce, If you are still experiencing this issue, please leave a comment and we will reopen the ticket for further investigation.
I've recently encountered this same issue with a production iOS app. The app was crashing on start-up on just some devices. I spotted this in the device log: Thread 2 name: Dispatch queue: com.appcelerator.anlaytics.databaseQueue Thread 2 Crashed: And this in a console log: [ERROR] The application has crashed with an uncaught exception 'PLSqliteException'. Reason: Attempted to access non-NSString * column as NSString *. Disabling analytics as described above solved the problem! The app does use a database, but to try and rule this out I replaced my normal start-up code with a very basic window. It didn't help. One other (strange?) thing I noticed: 1. Close the app from multi-tasking 2. Try to open the app (it crashes) 3. Look at the app in multi-tasking - you see the window which was open when the app was last running successfully (which is not the same window as when the app first opens). So closing the app from multi-tasking didn't seem to actually close it..? May be related, or may not be.
Managed to reproduce, also disabled analytics and it works. I have the database file in question locally, I'll try to attach it
I seem not to be able to upload a file here, I have it with SDK 6.3.0 on a recent file. I too use a local SQLite file, but disabling analytics did the trick for me. When in need of the file, please just contact me and I can email it.
My trace: [code] [ERROR] : The application has crashed with an uncaught exception 'PLSqliteException'. [ERROR] : Reason: [ERROR] : Attempted to access non-NSString * column as NSString *. [ERROR] : Stack trace: [ERROR] : 0 CoreFoundation 0x0000000181bd9d04
sqlite file: https://www.dropbox.com/s/fohtcnttoobjxor/analytics.db?dl=0