Skip to content

bug: "database is locked (code 5)" on 7.0.1 and 7.0.2 #659

@freezzone

Description

@freezzone

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions