Closed GoogleCodeExporter closed 8 years ago
Original comment by anshu.ah...@gmail.com
on 27 May 2010 at 2:55
Start to take a look at this issue.
Original comment by renc...@gmail.com
on 16 Jun 2010 at 3:55
Code review at:
http://codereview.appspot.com/1717045
Caused by:
Exception is caused by database cursor objects being left open even when not in
use. Excerpt from the logs:
06-16 16:36:27.458: INFO/dalvikvm(234): Uncaught exception thrown by finalizer
(will be discarded):
06-16 16:36:27.458: INFO/dalvikvm(234): Ljava/lang/IllegalStateException;:
Finalizing cursor android.database.sqlite.SQLiteCursor@43818050 on
RegisteredApps that has not been deactivated or closed
06-16 16:36:27.458: INFO/dalvikvm(234): at
android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
06-16 16:36:27.458: INFO/dalvikvm(234): at
dalvik.system.NativeStart.run(Native Method)
Another similar problem is found where the database object itself is left open
even when not in use. Excerpt from the logs:
06-16 16:14:21.893: ERROR/Database(233): Leak found
06-16 16:14:21.893: ERROR/Database(233): java.lang.IllegalStateException:
/data/data/edu.nyu.cs.omnidroid.app/databases/omnidroid SQLiteDatabase created
and never closed
06-16 16:14:21.893: ERROR/Database(233): at
android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1581)
06-16 16:14:21.893: ERROR/Database(233): at
android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
06-16 16:14:21.893: ERROR/Database(233): at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:
659)
06-16 16:14:21.893: ERROR/Database(233): at
android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:
652)
06-16 16:14:21.893: ERROR/Database(233): at
android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482)
06-16 16:14:21.893: ERROR/Database(233): at
android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
06-16 16:14:21.893: ERROR/Database(233): at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.ja
va:98)
06-16 16:14:21.893: ERROR/Database(233): at
edu.nyu.cs.omnidroid.app.model.CoreRuleDbHelper.<init>(CoreRuleDbHelper.java:65)
06-16 16:14:21.893: ERROR/Database(233): at
edu.nyu.cs.omnidroid.app.controller.HandlerService.onStart(HandlerService.java:5
8)
06-16 16:14:21.893: ERROR/Database(233): at
android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2776)
06-16 16:14:21.893: ERROR/Database(233): at
android.app.ActivityThread.access$3400(ActivityThread.java:116)
06-16 16:14:21.893: ERROR/Database(233): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1855)
06-16 16:14:21.893: ERROR/Database(233): at
android.os.Handler.dispatchMessage(Handler.java:99)
06-16 16:14:21.893: ERROR/Database(233): at
android.os.Looper.loop(Looper.java:123)
06-16 16:14:21.893: ERROR/Database(233): at
android.app.ActivityThread.main(ActivityThread.java:4203)
06-16 16:14:21.893: ERROR/Database(233): at
java.lang.reflect.Method.invokeNative(Native Method)
06-16 16:14:21.893: ERROR/Database(233): at
java.lang.reflect.Method.invoke(Method.java:521)
06-16 16:14:21.893: ERROR/Database(233): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
06-16 16:14:21.893: ERROR/Database(233): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
06-16 16:14:21.893: ERROR/Database(233): at
dalvik.system.NativeStart.main(Native Method)
Summary of changes:
Made sure that database cursor objects are closed when they are not needed
after acquiring them. Same thing also applies to database objects.
Test Cases (must check the logs that no exception occurs while performing
these):
1. Go all types of screens while creating a new rule - root event, add action,
add filter.
2. With Omnidroid active, go to home and open another application. Go back to
home and re-open Omnidroid.
3. Open Omnidroid and proceed to any screen as deep as possible. Keep on
pressing back until you reach the home screen and reopen Omnidroid again.
Original comment by renc...@gmail.com
on 18 Jun 2010 at 2:29
Forgot to add one more test case:
4. Trigger a saved rule.
Original comment by renc...@gmail.com
on 19 Jun 2010 at 2:06
Checked-in on r757.
Original comment by renc...@gmail.com
on 19 Jun 2010 at 3:09
Original issue reported on code.google.com by
EHo...@gmail.com
on 14 Dec 2009 at 4:34