-
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
Database malformation #703
Comments
I'm thinking about deleting and recreating database in case of corruption. Is it always possible to remove database file or it might be locked? |
Hi @kanoshin, This is the first report of corruption with the plugin. I saw quite a bit of possible corruption on the sqlite forum. In case of corruption it would probably be best to retrieve and then delete/remove the database file, if possible. Unfortunately I have very limited experience with file locking issues. I think sqlite(3) provides some tooling that can recover the data from a corrupted databases in certain cases. I can also say that there have been some issues with using the standard transaction mechanism together with multi-page applications ref: #666. It should be fixed in the latest version but it would probably still be safer to use the following calls instead:
In fact I also raised #690 to discuss the possibility of deprecating the old standard transaction mechanism. I hope this is somewhat helpful. I hope to address your issue in #702 ("Database might be busy when close is called") within the next few weeks or so. |
I received a similar report of corruption in a very small percentage of users of an iOS app by email. In that case the application is a single-page app and does not use the now deprecated Web SQL transaction calls. I can think of a couple possible causes:
Excellent workaround / solution is given in #716. For the future it would be better to either run all sqlite operations in a single background thread or one background thread per db, just like the implementation for Android. Possible reference: |
(SQLITE_THREADSAFE=1 on Android/Windows) to avoid possible database malformation due to multithreaded access ref: storesafe#703
- SQLITE_THREADSAFE=2 on iOS/macOS (SQLITE_THREADSAFE=1 on Android/Windows) to avoid possible malformed database due to multithreaded access ref: storesafe#703 - Drop -DSQLITE_OMIT_BUILTIN_TEST (renamed & not recommended) - Certain LOCAL_CFLAGS added from https://www.sqlite.org/compile.html#recommended_compile_time_options - Minor reordering
- SQLITE_THREADSAFE=2 on iOS/macOS (SQLITE_THREADSAFE=1 on Android/Windows) to avoid possible malformed database due to multithreaded access ref: storesafe#703 - Drop -DSQLITE_OMIT_BUILTIN_TEST (renamed & not recommended) - Certain LOCAL_CFLAGS added from https://www.sqlite.org/compile.html#recommended_compile_time_options - Minor reordering
Please try the latest cordova-sqlite-ext version, it has fixed build flag and workaround solution for #716. |
Build flag fix and workaround solution for #716 are now published for this plugin version, will be included in the other sqlite plugin versions in the near future. |
NOTE: cordova-sqlite-ext 0.10.6 has incorrect -DSQLITE_THREADSAFE=1 build flag on iOS due to a mistake in the merge. This will be changed to SQLITE_THREADSAFE=2 for iOS in the next release. ADDITIONAL NOTE: plugin.xml has duplicate macOS ("osx") platform section, also due to a mistake in the merge. The duplicate macOS platform section will be removed from the next release. ref: storesafe/cordova-sqlite-storage#703
- SQLITE_THREADSAFE=2 on iOS as well as macOS (SQLITE_THREADSAFE=1 on Android/Windows) to avoid possible malformed database due to multithreaded access ref: storesafe/cordova-sqlite-storage#703 - Suppress warnings for sqlite3.c on iOS/macOS Thanks again to @cjpearson for the suggestion in storesafe/cordova-sqlite-storage#569 - Some additional iOS build flag updates in this plugin version
…fore merge - SQLITE_THREADSAFE=2 on iOS & macOS (SQLITE_THREADSAFE=1 on Windows) to avoid possible malformed database due to multithreaded access ref: storesafe/cordova-sqlite-storage#703 - Suppress warnings for sqlite3.c on iOS/macOS Thanks again to @cjpearson for the suggestion in storesafe/cordova-sqlite-storage#569 - Some additional iOS/macOS/Windows build flag updates in this plugin version - Document sqlite (3.8.10.2) build settings
Merge branch 'evcore-common-master' cordova-sqlite-evcore-common-free compile-time option fixes for iOS/macOS: - SQLITE_THREADSAFE=2 on iOS/macOS to avoid possible malformed database due to multithreaded access ref: storesafe/cordova-sqlite-storage#703 - Suppress warnings when building sqlite3.c (iOS/macOS) - Remove unwanted SQLITE_OMIT_BUILTIN_TEST option (iOS/macOS) additional doc fixes
Merge branch 'evcore-common-master' cordova-sqlite-evcore-common-free compile-time option fixes for iOS/macOS: - SQLITE_THREADSAFE=2 on iOS/macOS to avoid possible malformed database due to multithreaded access ref: storesafe/cordova-sqlite-storage#703 - Suppress warnings when building sqlite3.c (iOS/macOS) - Remove unwanted SQLITE_OMIT_BUILTIN_TEST option (iOS/macOS) Additional doc fixes
@brodybits : I am also facing the same issue of "database disk image is malformed" in android. I have installed whti plugin near to Aug 2017. So can you please me that this issue is resolved in this plugin version or I have to use another plugin(please share the new plugin url if required)? Please help me asap I am very much stucked. |
@NileshSystematix please see storesafe/cordova-sqlite-storage-help#34 (comment) for the answer to your question. |
@brodybits : Thanks a lot, I have read the issue but can you please confirm me more so that I can save my time. |
See storesafe/cordova-sqlite-storage-help#34 (comment) If you have any more questions please ask in storesafe/cordova-sqlite-storage-help#34 or raise a new issue. |
As discussed in #754 I got the |
Hello,
in logs I received from iOS clients I found such error:
{"result":{"code":0,"sqliteCode":11,"message":"database disk image is malformed"}}
Percentage of clients who had this error in logs is really small (~0.01%), but I suspect that it might be higher because in some cases our logging depends on database.
Also we have complaints that sometimes it is required to reinstall app to make it work, database malformation might perfectly explain such reports.
Do you know what might cause database malformation?
We use only yours plugin to communicate with database, so 3rd party shouldn't be the case. Our app has multiple pages. Also periodically we close and reopen database because previously we had issues with hanging transactions.
The text was updated successfully, but these errors were encountered: