Crashes caused by TimeoutException

We just released an application and users report crashes caused by following Exception.

Fatal Exception: java.util.concurrent.TimeoutException
net.sqlcipher.database.SQLiteCompiledSql.finalize() timed out after 10 seconds

java.lang.Object.wait (
java.lang.Thread.parkFor$ (
sun.misc.Unsafe.park (
java.util.concurrent.locks.LockSupport.park (
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt (
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued (
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire (
java.util.concurrent.locks.ReentrantLock$FairSync.lock (
java.util.concurrent.locks.ReentrantLock.lock (
net.sqlcipher.database.SQLiteDatabase.lock (
net.sqlcipher.database.SQLiteCompiledSql.releaseSqlStatement (
net.sqlcipher.database.SQLiteCompiledSql.finalize (
java.lang.Daemons$FinalizerDaemon.doFinalize (
java.lang.Daemons$ ( (

We use SQLCipher 3.5.9 and Android from 4.4.2 to 7.0.
Is there a way we can avoid those crashes?

Hello @korwinek

Are you using multiple threads to read/write to the database? If so, you might consider using the WAL journaling mode if you aren’t already. More information about WAL can be found here. Also, you could set a busy timeout period which may allow additional time for locks to clear. You can find more info on setting a timeout here.