[stable-25.0.x] avoid FK constraint exceptions - #6599
Merged
Conversation
Exception android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787) at net.zetetic.database.sqlcipher.SQLiteConnection.nativeExecute at net.zetetic.database.sqlcipher.SQLiteConnection.execute (SQLiteConnection.java:592) at net.zetetic.database.sqlcipher.SQLiteSession.execute (SQLiteSession.java:624) at net.zetetic.database.sqlcipher.SQLiteStatement.execute (SQLiteStatement.java:70) at androidx.sqlite.driver.SupportSQLiteStatement$OtherSQLiteStatement.step (SupportSQLiteStatement.android.kt:540) at androidx.room.EntityInsertAdapter.insert (EntityInsertAdapter.kt:59) at com.nextcloud.talk.data.database.dao.ConversationsDao_Impl.insertConversation$lambda$0 (ConversationsDao_Impl.kt:336) at com.nextcloud.talk.data.database.dao.ConversationsDao_Impl$$ExternalSyntheticLambda5.invoke (D8$$SyntheticClass) at androidx.room.util.DBUtil__DBUtil_androidKt$performBlocking$1$1$invokeSuspend$$inlined$internalPerform$1.invokeSuspend (DBUtil.kt:173) at androidx.room.util.DBUtil__DBUtil_androidKt$performBlocking$1$1$invokeSuspend$$inlined$internalPerform$1.invoke (DBUtil.kt:8) at androidx.room.util.DBUtil__DBUtil_androidKt$performBlocking$1$1$invokeSuspend$$inlined$internalPerform$1.invoke (DBUtil.kt:4) at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invokeSuspend (PassthroughConnectionPool.kt:59) at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invoke (PassthroughConnectionPool.kt:8) at androidx.room.coroutines.PassthroughConnectionPool$useConnection$2.invoke (PassthroughConnectionPool.kt:4) This could happen when a account was deleted and chat sync is in progress at the same time. This might be a side effect of duplicated accounts. See https://github.com/nextcloud/talk-android/pull/6559/files which might even trigger the FK constraint more often by deleting duplicated accounts. The conversation (and cascaded via its account removal) may have been deleted between persisting chatMessageEntities above and this chat block write, tripping the ChatBlocks.internalConversationId foreign key. The block is now moot. Signed-off-by: Marcel Hibbe <dev@mhibbe.de> Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Contributor
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/33090025865/artifacts/9659524776 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #6593