capacitor-community / capacitor-community/sqlite
bug: "database is locked (code 5)" on 7.0.1 and 7.0.2
- Dominant language
- Swift
- Stars
- 661
- Forks
- 158
- PR merge metrics
- No merged PRs in 30d
Description
**Plugin version:**
7.0.1, 7.0.2 - broken on these versions
7.0.0 - works on this version
**Platform(s):**
android 14
**Current behavior:**
It is not possible to start a transaction, after page is reloaded (for example when reload is done using `location.reload();` or navigated back `history.back();`) when a reload happened in the middle of a transaction. After the reload, if any transaction is started, it errors with `database is locked (code 5)` and it is not possible to fix this issue by calling `close()` or `closeConnection()` or `checkConnectionsConsistency()`.
When the database gets to this state, only possible workaround is to kill the app and start again.
In version `7.0.0` was the solution to call `closeConnection()`, after page every reload.
Using version `7.0.0` is not a solution anymore, because of "Google Play's 16 KB page size requirements" that will be effective from Nov 1, 2025.
**Expected behavior:**
It should be possible to use the database after page reload, it should not remain locked.
**Steps to reproduce:**
1. connect to database
2. start transaction
3. do any query
4. do `location.reload();`
5. wait for reload
6. connect to the database
7. start transaction
8. do any query
**Related code:**
I cannot provide code at the moment, I might be able by end of the next month if necessary.
**Other information:**
N/A
**Capacitor doctor:**
```
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 7.4.3
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3
@capacitor/ios: 7.4.3
Installed Dependencies:
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3
@capacitor/cli: 7.1.0
@capacitor/ios: 7.4.3
```
Contributor guide
Assessment
This issue has not been assessed yet.