After updating sqlcipher-android:4.5.3 to sqlcipher-android:4.6.1 seeing multiple crashes

net.zetetic.database.sqlcipher.SQLiteConnectionPool.throwIfClosedLocked
Exception java.lang.RuntimeException: An error occurred while executing doInBackground()
at androidx.loader.content.ModernAsyncTask$3.done (ModernAsyncTask.java:164)
at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:381)
at java.util.concurrent.FutureTask.setException (FutureTask.java:250)
at java.util.concurrent.FutureTask.run (FutureTask.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
at java.lang.Thread.run (Thread.java:1012)
Caused by java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.throwIfClosedLocked (SQLiteConnectionPool.java:974)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.waitForConnection (SQLiteConnectionPool.java:689)
at net.zetetic.database.sqlcipher.SQLiteConnectionPool.acquireConnection (SQLiteConnectionPool.java:360)
at net.zetetic.database.sqlcipher.SQLiteSession.acquireConnection (SQLiteSession.java:929)
at net.zetetic.database.sqlcipher.SQLiteSession.executeForCursorWindow (SQLiteSession.java:869)
at net.zetetic.database.sqlcipher.SQLiteQuery.fillWindow (SQLiteQuery.java:68)
at net.zetetic.database.sqlcipher.SQLiteCursor.fillWindow (SQLiteCursor.java:196)
at net.zetetic.database.sqlcipher.SQLiteCursor.getCount (SQLiteCursor.java:135)
at android.content.ContentResolver.query (ContentResolver.java:1252)
at android.content.ContentResolver.query (ContentResolver.java:1165)
at androidx.core.content.ContentResolverCompat$Api16Impl.query (ContentResolverCompat.java:119)
at androidx.core.content.ContentResolverCompat.query (ContentResolverCompat.java:87)
at androidx.loader.content.CursorLoader.loadInBackground (CursorLoader.java:63)
at androidx.loader.content.CursorLoader.loadInBackground (CursorLoader.java:41)
at androidx.loader.content.AsyncTaskLoader.onLoadInBackground (AsyncTaskLoader.java:307)
at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground (AsyncTaskLoader.java:60)
at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground (AsyncTaskLoader.java:48)
at androidx.loader.content.ModernAsyncTask$2.call (ModernAsyncTask.java:141)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)

Hi @Akshay,

Is this something you can produce in an isolated application for review? Additionally, you might consider updating sqlcipher-android, currently the latest version is 4.7.2.

Hi @developernotes,
We are using sqlcipher-android 4.6.1 version and recently uploaded it to production. We don’t have any sample app to share. Do you have any suggestion based upon the shared logs.

Hi @Akshay,

We have just released SQLCipher 4.8.0 [1]. Our suggestion would be to update to the latest version of the library and perform internal testing. If you’re able to reproduce the issue with 4.8.0, I would suggest trying to narrow down a reproduction of the issue, potentially creating a small standalone reproduction case which would allow us to review further.


  1. SQLCipher 4.8.0 Release | Zetetic ↩︎

Hello @Akshay - how are you managing the lifecycle of the relevant SQLiteDatabase? Are you calling close() on it while there may be pending operations in other threads?