Room SQLiteConnectionPool leakage
See original GitHub issueRoom doesn’t close connection pool. After some background requests the logcat print the following warning message:
W/SQLiteConnectionPool: A SQLiteConnection object for database '%DATABASE_NAME%' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
Current Room version:
implementation 'android.arch.persistence.room:runtime:1.1.1-rc1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1-rc1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:8 (1 by maintainers)
Top Results From Across the Web
SQLite connection object leaked - Android - Stack Overflow
So my databaseHelper does extend SQLiteOpenHelper. I get a sqlite connection leak warning in the Logcat so would like some advice about what...
Read more >refs/heads/androidx-room-release - Google Git
refs/heads/androidx-room-release. commit, 3da604b8524188eb6965fc43d22d6b4bfd7bd6b3 ... android/database/sqlite/SQLiteConnectionPool.java[Added - diff] ...
Read more >Room/Paging: Needs a Way To Safely Close the Database ...
java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed. at android.database.sqlite.SQLiteConnectionPool.
Read more >[Fixed]-Android Migrate from SQLite to Room
SQLiteConnectionPool : A SQLiteConnection object for database '/data/user/0/com. · SQLite GROUP BY on result of union not using indexes of constituent tables ...
Read more >SQLite Android Bindings: Check-in Differences
To avoid memory leaks, the application should invoke [sqlite3_free()] ** on ... The underlying VFS might choose to preallocate database ** file space...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you use DI, make sure that the
RoomDatabase
instance is a singleton which is bound to the application lifecycle.As it turns out the
RoomDatabase
instance must/should not be closed manually. The solution is to keep only one instance of the database in your application, for example in a static field in yourApplication
class or managed via a dependency injection framework.The leak warning will only occur if you open multiple database instances (for example one instance in each
Activity
) and don’t close them.