matrix-org / matrix-org/matrix-rust-sdk

When a database gets corrupted, we should automatically recreate it

Open
#6,298 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

On the Element X Android app we received a bug report with this error message:

```
MediaStore(Backend(Sqlite(SqliteFailure(Error { code: DatabaseCorrupt, extended_code: 11 }, Some("database disk image is malformed")))))
```

And the user says they can't see any images in the timeline (I guess it's the same for the avatars of rooms and users?).

It seems like at least for this DB and maybe the event cache one, we should re-create the DB when we get one of these `DatabaseCorrupt` codes.

PS: sorry for the delay creating this issue, I was just reminded of it 😅 .

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by tracing the MediaStore and Sqlite handling for the DatabaseCorrupt error, including the event cache database path. Done means affected databases are recreated after corruption and timeline images, room avatars, and user avatars become available again.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
databases, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.