-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Root cause of bug #193: loss of data on certain Android versions? #462
Comments
I will gladly help if i know what i have to do buddy, but i just post something and for you know so far the app is running smoothly without loosing any data (I never close the database). Tested it on Ipad Ios 9.3.2 and Android 4.4. and sometimes on emulator Nexus 9 with API 23 Will contact you if there is something comes up as you mention in here (hopefully not lol) |
Hi, First of all, thanks for all of you hard work on this plugin. One of my clients has experienced this issue twice on different devices. Unfortunately I can't tell you anything about the versions of android etc or what caused it so I'm not much help : (. It seems to be that the data appears to be there and then after some event happens the recently inserted data is lost which makes me wonder about "hot journals" as seen in 1.3 at this link https://www.sqlite.org/howtocorrupt.html . ie the Journal is lost but other data remains. I wonder if in some situations the COMMIT doesn't get passed to the database? I know this is all overly simplistic and probably doesn't help you at all. This issue posses a huge issue for our product so hopefully someone can help you resolve it. |
Are you using the I just added a note to the original description that this should only be an issue when using the
According to the referenced section the journal contains rollback data. The changes are committed by simply deleting the the rollback journal, unless certain versions of the Android platform change the SQLite journal mode somehow. |
The is speculation but I put it here in case it can help us find the root cause. Assuming the SQLite journal mode is not changed from the default, I can think of the following possible theories:
I would be very surprised if theory 1 would be true. A quick look at the SQLite code related to sqlite3_close()/sqlite3_close_v2() does not reveal anything special to flush any outstanding changes. A quick look through the AOSP SQLite database code does not reveal this either. I came up with theory 2 based on an observation at https://groups.google.com/d/msg/Cordova-SQLitePlugin/oq8wMDSH4M4/LLyAPjSXyzIJ, and it seems to be consistent with the workaround solution. Some references:
|
Hi,
No I'm not. And unfortunately I can't reproduce this issue at all. I have a client that has about 30 tablets in the field and in the space of a year it has occurred twice.
Can I ask a further question, do you have confirmation that this error no longer occurs when androidLockWorkaround: 1 is used? Does this work around close the database after each transaction? Thanks, |
We're seeing some data loss due to apparent database rollbacks on some Zebra MC40 devices, which is our main type of device in the field. I've not heard of the issue occurring on any other devices, but most of our customers are using the MC40. We store some sequence number information in local storage as well as in one of our SQLite databases, which is becoming inconsistent. This sequence number is the latest transaction ID that has been reported as committed on the server, and comes from an AUTOINCREMENT column in SQLite, so I was very surprised to find the database's sequence number (in the sqlite_sequence table) being much older than that in local storage. It seems to be happening on both Android 4.1.1 Jellybean and on Android 4.4.4 KitKat - mostly we're getting reports from the field that some data was never sent to the server, and some data on the server does not appear on the device. We don't yet have repeatable reproduction steps. When my colleague reproduced the issue, he mentioned that the app had crashed and then been restarted. So far I have not been able to reproduce it with the 'Don't keep activities' developer mode option. Versions, options:
|
@MikeDimmickMnetics please upgrade to a more recent of cordova-sqlite-storage. Some versions including cordova-sqlite-storage 1.2.2 would ignore the |
I received the following question in December 2014 which was eventually reported in #193: https://groups.google.com/forum/#!topic/Cordova-SQLitePlugin/oq8wMDSH4M4
For some reason, it would lose data if the app does not close the database before it stops.
I introduced a crude
androidLockWorkaround
option that would simply close and reopen the database between transactions. In addition, some other versions such as cordova-sqlite-ext and Cordova-sqlcipher-adapter use custom-built database implementations that would not suffer from this issue.Unfortunately I have not been able to reproduce this issue myself, which I would need to justify raising a bug on AOSP (Android project).
I recently heard that this is especially bad on Android 5.1. I have no idea if this would still be an issue on Android 6.
If anyone in the community can help track down the cause of this issue and perhaps file a bug report on the Android platform I would be very grateful.
IMPORTANT (UPDATE): This should ONLY be an issue in case the
androidDatabaseImplementation: 2
is used. If anyone sees a similar issue without usingandroidDatabaseImplementation: 2
please report this in a new issue along with a reproduction program.The text was updated successfully, but these errors were encountered: