Fixed
Status Update
Comments
yb...@google.com <yb...@google.com>
da...@google.com <da...@google.com> #2
For a reproduction case:
1. Downloadhttps://github.com/romannurik/muzei
2. Checkout to room-issue-2.1.0-alpha03 tag
3. Change the ProviderDao to abstract suspend fun insert(provider: Provider)
4. Run the app, hit the Activate button
Expected Result: the image is loaded
Actual Result: the insert never returns (you only see a black screen), blocking the arch thread forever
1. Download
2. Checkout to room-issue-2.1.0-alpha03 tag
3. Change the ProviderDao to abstract suspend fun insert(provider: Provider)
4. Run the app, hit the Activate button
Expected Result: the image is loaded
Actual Result: the insert never returns (you only see a black screen), blocking the arch thread forever
he...@gmail.com <he...@gmail.com> #3
this is partially fixed in
https://android-review.googlesource.com/c/platform/frameworks/support/+/850190
though with usages of begin / end; worse situations can happen that we cannot recover.
A full fledged fix requires a new transaction API.
That being said, if app uses db.runInTrasaction; this bug would not happen (because you cannot launch inside it).
maybe we should deprecate begin/end ?
though with usages of begin / end; worse situations can happen that we cannot recover.
A full fledged fix requires a new transaction API.
That being said, if app uses db.runInTrasaction; this bug would not happen (because you cannot launch inside it).
maybe we should deprecate begin/end ?
Description
Version used:1.1.1
Devices/Android versions reproduced on: All
File: FrameworkSQLiteOpenHelper
FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
FrameworkSQLiteDatabase dbRef = mDbRef[0];
if (dbRef == null) {
dbRef = new FrameworkSQLiteDatabase(sqLiteDatabase);
mDbRef[0] = dbRef;
}
return mDbRef[0];
}
Room always preserve The First Open db, even if it is closed.
Sometimes sqLiteDatabase != mDbRef[0].mDelegate, we get the wrong db from room.
This occurs when opening db, then something wrong and throws exception, but app caught it. The next time we use room, it throws re-open exception.
I thinks mDbRef[0].mDelegate should change when sqLiteDatabase is changed.
Like this:
FrameworkSQLiteDatabase getWrappedDb(SQLiteDatabase sqLiteDatabase) {
FrameworkSQLiteDatabase dbRef = mDbRef[0];
if (dbRef == null || dbRef.isDatabaseChanged(sqLiteDatabase)) {
dbRef = new FrameworkSQLiteDatabase(sqLiteDatabase);
mDbRef[0] = dbRef;
}
return mDbRef[0];
}
File: FrameworkSQLiteDatabase
public boolean isDatabaseChanged(SQLiteDatabase db) {
return mDelegate != db;
}