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

Application did not close the cursor or database object that was opened here (net.sqlcipher.database.DatabaseObjectNotClosedException) #410

Closed
zoff99 opened this issue May 21, 2017 · 8 comments
Labels
sqlcipher Related to SQLCipher wontfix

Comments

@zoff99
Copy link
Contributor

zoff99 commented May 21, 2017

i am getting these with 5.0.0-rc1 with encrypted database when i exit my app

###/com.zoffcc.applications.trifa E/Database: close() was never explicitly called on database '/data/user/0/xxxxxx/xxxx.db' 
net.sqlcipher.database.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
    at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:2402)
    at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1148)
    at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1203)
    at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1198)
    at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1183)
    at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1219)
    at com.github.gfx.android.orma.encryption.EncryptedDatabase$Provider.provideOnDiskDatabase(EncryptedDatabase.java:170)
    at com.github.gfx.android.orma.OrmaConnection.openDatabase(OrmaConnection.java:106)
    at com.github.gfx.android.orma.OrmaConnection.<init>(OrmaConnection.java:96)
    at com.zoffcc.applications.trifa.OrmaDatabase$Builder.build(OrmaDatabase.java:466)
    at com.zoffcc.applications.trifa.MainActivity.onCreate(MainActivity.java:395)
    at android.app.Activity.performCreate(Activity.java:6681)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2651)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2765)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1506)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:153)
    at android.app.ActivityThread.main(ActivityThread.java:6234)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
@gfx
Copy link
Member

gfx commented May 23, 2017

This is the spec. Keep the database connection as a global, singleton instance.

It is not intended that you connect the DB for each time in use.

However, if you really know what you are doing, OrmaConnection#close() is provied in v5.0.0-rc3.

@gfx gfx closed this as completed May 23, 2017
@gfx gfx added the wontfix label May 23, 2017
@zoff99
Copy link
Contributor Author

zoff99 commented May 25, 2017

i do not connect again. it just crashes often with this error. and after that the database table is corrupt and app can never start again.
the DB is defined as static in a Forgroundservice

@gfx
Copy link
Member

gfx commented May 26, 2017

Oh, really?

Should be investigated more deeply.

Can you tell me more information about it? Do you have a minimum re-producable code?

@gfx gfx reopened this May 26, 2017
@zoff99
Copy link
Contributor Author

zoff99 commented May 26, 2017

i have now switched back to 4.x without encryption

@gfx gfx added the sqlcipher Related to SQLCipher label Oct 8, 2018
@gfx
Copy link
Member

gfx commented Oct 9, 2018

I guess this is a bug in SQLCipher. I have no idea about it.

@gfx gfx closed this as completed Oct 9, 2018
@gfx gfx changed the title Application did not close the cursor or database object that was opened here Application did not close the cursor or database object that was opened here (net.sqlcipher.database.DatabaseObjectNotClosedException) Oct 9, 2018
@avivmock
Copy link

avivmock commented Jul 8, 2019

I am facing a similar issue, Does someone found any solutions?

@gfx
Copy link
Member

gfx commented Jul 9, 2019

Please issue it to SQLCipher's issue tracker. I think it's the SQLCipher's problem.

@jvivekd
Copy link

jvivekd commented Feb 24, 2020

This is especially happening for delete queries

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

No branches or pull requests

4 participants