SQLiteException: unable to close due to unfinalized statements or unfinished backups

For SafeRoom, I have a report of a crash from an encrypt() utility method:

Caused by net.sqlcipher.database.SQLiteException: unable to close due to unfinalized statements or unfinished backups: sqlite3_close() failed
       at net.sqlcipher.database.SQLiteDatabase.dbclose(SQLiteDatabase.java)
       at net.sqlcipher.database.SQLiteDatabase.onAllReferencesReleased + 513(SQLiteDatabase.java:513)
       at net.sqlcipher.database.SQLiteDatabase.close + 1401(SQLiteDatabase.java:1401)
       at com.commonsware.cwac.saferoom.SQLCipherUtils.encrypt + 215(SQLCipherUtils.java:215)
       at com.commonsware.cwac.saferoom.SQLCipherUtils.encrypt + 152(SQLCipherUtils.java:152)

This encrypt() method encrypts an unencrypted SQLite database using sqlcipher_export. It has no background threads.

Does that “unable to close due to unfinalized statements or unfinished backups” message ring any bells?

Thanks!

Hi @commonsguy

Are you able to reproduce it? I wonder if you call close() on your SQLiteStatement if the behavior would change?

Are you able to reproduce it?

Nope. Neither can the person who reported the problem.

I wonder if you call close() on your SQLiteStatement if the behavior would change?

I can certainly add that — thanks for the suggestion!

Certainly, keep us posted on what you find out!