DB Close Issue
Closed this issue · 2 comments
Occurs at interesting times after installation. Called even when traveling to the Settings page after Title install. This is interesting because I'm not sure why the app cares what happened to the db, but maybe we need to close on destroy? Shooting in the dark here at this point.
E/Database( 824): close() was never explicitly called on database '/data/data/com.buzzwords/databases/buzzwords'
E/Database( 824): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
E/Database( 824): at android.database.sqlite.SQLiteDatabase.(SQLiteDatabase.java:1847)
E/Database( 824): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820)
E/Database( 824): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:854)
E/Database( 824): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:847)
E/Database( 824): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:547)
E/Database( 824): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:203)
E/Database( 824): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:118)
E/Database( 824): at com.buzzwords.Deck$DeckOpenHelper.installPack(Deck.java:757)
E/Database( 824): at com.buzzwords.Deck$DeckOpenHelper.installPackFromServer(Deck.java:724)
E/Database( 824): at com.buzzwords.Deck.installPack(Deck.java:197)
E/Database( 824): at com.buzzwords.GameManager.installPack(GameManager.java:376)
E/Database( 824): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:516)
E/Database( 824): at com.buzzwords.PackPurchaseActivity$PackSyncronizer.doInBackground(PackPurchaseActivity.java:1)
E/Database( 824): at android.os.AsyncTask$2.call(AsyncTask.java:185)
E/Database( 824): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
E/Database( 824): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
E/Database( 824): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
E/Database( 824): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
E/Database( 824): at java.lang.Thread.run(Thread.java:1019)
This feels like a race condition of some sort. Happens intermittently.
I've fixed this by adding an if open then close statement after each endTransaction. This happened all the time on Amazon emulator and doesn't anymore so I think it's been fixed.