Android-Debug-Database icon indicating copy to clipboard operation
Android-Debug-Database copied to clipboard

Android-Debug-Database prevents Room from persisting data.

Open aaron-dunigan-atlee opened this issue 5 years ago • 14 comments

I'm using this library with Room 1.1.1., running my app on an emulated Nexus 5X, API 26. Everything works fine at first: I can view the database correctly. But AFTER I have viewed the database using Android-Debug-Database, my db only persists ONE more insertion. After that, all attempted INSERT commands don't get persisted... no errors, code runs smoothly as if the database were updated, but when I view the db, the extra INSERTs aren't there. I spent hours trying to find the bug in my code, only to realize that it was this library that was causing the bug. After removing A-D-D, all INSERT commands work correctly.

aaron-dunigan-atlee avatar Oct 07 '18 20:10 aaron-dunigan-atlee

Oh... Let me verify it.

amitshekhariitbhu avatar Oct 08 '18 03:10 amitshekhariitbhu

Thanks for looking into it. If you want to test it against my code, it's at https://github.com/aaron-dunigan-atlee/jfk-hyannis-museum-virtual-tour/commit/9e3636ef027c910c0d4d61baed541c4ace0e0e67 (The commit that says "Database not working") To add to the database, you'll need to scan QR codes; I've attached a few samples in the format that my app recognizes. This seems like a useful library... if you can fix this bug, I'll keep using it. barcode_1000 barcode_1001 barcode_2000 barcode_2001

aaron-dunigan-atlee avatar Oct 10 '18 09:10 aaron-dunigan-atlee

I had just the same issue @aaron-dunigan-atlee describes. Unfortunately it took me also a very long time to find out what was causing my app not to persist the DB...

SilviaSantano avatar Oct 19 '18 11:10 SilviaSantano

I am experiencing the same issue with Room 2.1.0-alpha01 and Android-Debug-Database 1.0.4. It somehow is corrupting my database as well and subsequent queries can result in exception: disk I/O error (code 522 SQLITE_IOERR_SHORT_READ).

AndreasBackx avatar Oct 19 '18 20:10 AndreasBackx

Same issue with Room 2.1.0-alpha03 and Android-Debug-Database 1.0.4.

MarioNoll avatar Dec 21 '18 08:12 MarioNoll

Same issue android.arch.persistence.room:runtime:1.1.1 com.amitshekhar.android:debug-db:1.0.4

snowb1shop avatar Jan 15 '19 11:01 snowb1shop

Same isssue here android.arch.persistence.room:runtime:1.1.0 com.amitshekhar.android:debug-db:1.0.4

I have noticed that the return value from insert operation is ok, but I can't see the item in db online. In fact, after I kill my app and reload data from database, I CANNOT see my item that I want. Therefore, I doubt that there is something wrong with debug-db. I remove it and do the same operatoions, everything is ok.

jhwsx avatar Jan 18 '19 07:01 jhwsx

Same issue here as well:

implementation "androidx.room:room-runtime:2.1.0-alpha04"
kapt "androidx.room:room-compiler:2.1.0-alpha04"
testImplementation "androidx.room:room-testing:2.1.0-alpha04"

debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'

ernestoyaquello avatar Feb 09 '19 21:02 ernestoyaquello

Same issue here. It seems that refreshing the web page a few times causes write operations to cease. The in-memory DB works just fine, but upon re-deploying, a crash, or restarting the app, it can only load what the DB has written to disk, and the data loss becomes apparent.

planobrett avatar Feb 13 '19 00:02 planobrett

Hi, I could reproduce the same issue and analyze the cause. I don't think it is related to this project, although there should be a change regarding database download function in the browser.

Sqlite3 database consists of 3 files, all 3 files are needed in order to have full data content:

  1. _db
  2. _db-shm
  3. _db-wal

When you click the download button in the web-gui, you only get the _db file, thus you won't see the full data set. It is quite tricky because you won't get an error in the sqlite viewer, and the 2 missing files are created on the fly (I verified with several db viewer tools).

In order to verify this theory I used 'adb pull' with the emulator but also 'adb backup' with a real device. In both cases all data sets are there, as long as you pull all three files! There is no difference in having a dependency to this android debug artifact.

Never-the-less I would suggest the following fix: "Clicking the download button, starts zip (or tar.gz) archive download with 3 files as content, namely _db, _db-shm, _db-wal."

The single file download is useless with sqlite3.

xordonkey avatar May 10 '19 15:05 xordonkey

Same issue here. It seems that refreshing the web page a few times causes write operations to cease. The in-memory DB works just fine, but upon re-deploying, a crash, or restarting the app, it can only load what the DB has written to disk, and the data loss becomes apparent.

Same here. At every web page refresh A-D-D try to change DB journal_mode to PERSIST and crash. No more update or insert are possible after that !

E/SQLiteLog: (5) statement aborts at 2: [PRAGMA journal_mode=PERSIST]

W/SQLiteConnection: Could not change the database journal mode of '/data/user/0/wiped/databases/wiped' from 'wal' to 'PERSIST' because the database is locked. This usually means that there are other open connections to the database which prevents the database from enabling or disabling write-ahead logging mode. Proceeding without changing the journal mode.

Dabada avatar May 26 '19 03:05 Dabada

I'm kind of dependent on this library. Is this issue being taken up? @amitshekhariitbhu

abhinav-adtechs avatar Sep 17 '19 15:09 abhinav-adtechs

@abhinav-adtechs Please let me know which version of the libraries you are using for both Room and Android-Debug-Database

amitshekhariitbhu avatar Sep 20 '19 08:09 amitshekhariitbhu

Is there any updated regarding this problem? I am experiencing the same situation

hlinero avatar Dec 17 '19 19:12 hlinero