Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRAGMA journal_mode=TRUNCATE] database is locked With Room #157

Open
mianaliasjad opened this issue May 26, 2019 · 5 comments
Open

[PRAGMA journal_mode=TRUNCATE] database is locked With Room #157

mianaliasjad opened this issue May 26, 2019 · 5 comments

Comments

@mianaliasjad
Copy link

This is a cool library to check datasbe. But when using with Room i was seeing this log in my logcat.

2019-05-27 04:46:06.569 3634-3691/com.test E/SQLiteLog: (5) statement aborts at 1: [PRAGMA journal_mode=TRUNCATE] database is locked
2019-05-27 04:46:06.579 3634-3691/com.test W/SQLiteConnection: Could not change the database journal mode of '/data/user/0/com.test/databases/MyDb' from 'wal' to 'TRUNCATE' because the database is locked.  This usually means that there are other open connections to the database which prevents the database from enabling or disabling write-ahead logging mode.  Proceeding without changing the journal mode.

It took me 1 day to figure out that this library was causing this issue.

@abhinav-adtechs
Copy link

Can you confirm this?

@pvthiendeveloper
Copy link

android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: PRAGMA journal_mode
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)
        at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:635)
        at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:321)
        at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:295)
        at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:216)
        at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:194)
        at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:493)
        at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:200)
        at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:192)
        at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:864)
        at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:849)
        at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:750)
        at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:767)
        at com.amitshekhar.debug.sqlite.DebugDBFactory.create(DebugDBFactory.java:13)
        at com.amitshekhar.server.RequestHandler.openDatabase(RequestHandler.java:187)
        at com.amitshekhar.server.RequestHandler.getTableListResponse(RequestHandler.java:306)
        at com.amitshekhar.server.RequestHandler.handle(RequestHandler.java:113)
        at com.amitshekhar.server.ClientServer.run(ClientServer.java:77)
        at java.lang.Thread.run(Thread.java:764)

This is my issue! When i use ROOM database and androidx.

@ErickMaeda
Copy link

Also experiencing this issue here!

Screenshot 2020-04-02 at 00 39 26

@aaghan
Copy link

aaghan commented May 21, 2020

can any one help on solving the issue for instance? even after removing the library implementation, it is giving the same error.

@pvthiendeveloper
Copy link

pvthiendeveloper commented May 22, 2020

My issue occurs when I use the Firebase Database. And I remove this code to resolve issue:

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants