Last Comment Bug 703602 - Unclosed Cursor warning in Fennec Native
: Unclosed Cursor warning in Fennec Native
Status: VERIFIED FIXED
:
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All Android
: P3 normal (vote)
: ---
Assigned To: Lucas Rocha (:lucasr)
:
: Sebastian Kaspari (:sebastian)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-18 07:36 PST by Kartikaya Gupta (email:kats@mozilla.com)
Modified: 2012-01-09 11:43 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
11+


Attachments
Close cursor when getting favicon URL (1.05 KB, patch)
2011-11-18 08:24 PST, Lucas Rocha (:lucasr)
bugmail: review+
Details | Diff | Splinter Review

Description Kartikaya Gupta (email:kats@mozilla.com) 2011-11-18 07:36:32 PST
Happening on latest birch (rev 9999a423d8ab) running on a Droid Pro. I just loaded TechCrunch.com and saw this in the logcat output.

11-18 10:07:49.271  9038  9039 E Cursor  : Finalizing a Cursor that has not been deactivated or closed. database = /data/data/org.mozilla.fennec_kats/databases/favicon_urls.db, table = favicon_urls, query = SELECT favicon_url FROM favicon_urls WHERE (page_url = ?)
11-18 10:07:49.271  9038  9039 E Cursor  : android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
11-18 10:07:49.271  9038  9039 E Cursor  : 	at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1350)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:330)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:280)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at org.mozilla.gecko.Favicons$DatabaseHelper.getFaviconUrlForPageUrl(Favicons.java:128)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at org.mozilla.gecko.Favicons$LoadFaviconTask.doInBackground(Favicons.java:371)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at org.mozilla.gecko.Favicons$LoadFaviconTask.doInBackground(Favicons.java:215)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at android.os.AsyncTask$2.call(AsyncTask.java:185)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at java.util.concurrent.FutureTask.run(FutureTask.java:137)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
11-18 10:07:49.271  9038  9039 E Cursor  : 	at java.lang.Thread.run(Thread.java:1096)
Comment 1 Lucas Rocha (:lucasr) 2011-11-18 08:24:01 PST
Created attachment 575470 [details] [diff] [review]
Close cursor when getting favicon URL
Comment 2 Kartikaya Gupta (email:kats@mozilla.com) 2011-11-18 08:25:23 PST
Comment on attachment 575470 [details] [diff] [review]
Close cursor when getting favicon URL

I'd prefer to see something like https://wiki.mozilla.org/Fennec/NativeUI/CodingStyle#Closing_resources - although if you want to do that in a separate patch i can r+ this one.
Comment 3 Lucas Rocha (:lucasr) 2011-11-18 08:49:36 PST
(In reply to Kartikaya Gupta (:kats) from comment #2)
> Comment on attachment 575470 [details] [diff] [review] [diff] [details] [review]
> Close cursor when getting favicon URL
> 
> I'd prefer to see something like
> https://wiki.mozilla.org/Fennec/NativeUI/CodingStyle#Closing_resources -
> although if you want to do that in a separate patch i can r+ this one.

r+ this one and I'll upload a separate patch refactoring the other parts of the Favicons to follow the suggested idiom.
Comment 4 Mark Finkle (:mfinkle) (use needinfo?) 2011-11-21 13:40:02 PST
Lucas - can we land/close this bug?
Comment 5 Lucas Rocha (:lucasr) 2011-11-22 06:13:16 PST
Pushed: http://hg.mozilla.org/projects/birch/rev/c26b7a14e5bd

Kats, I filed bug 704466 to track the promised refactoring.
Comment 6 Andreea Pod 2011-11-23 02:01:34 PST
Is there a way we can verify this?
Comment 7 Andreea Pod 2011-11-24 00:08:34 PST
I loaded TechCrunch.com and looked in aLogcat but there was no unclosed cursor warning. 
Marking as verified fixed, build: Mozilla /5.0 (Android;Linux armv7l;rv:9.0a1) Gecko/20111123 Firefox/10.0a1 Fennec/10.0a1 
Device: LG Optimus 2X (Android 2.2)

Note You need to log in before you can comment on or make changes to this bug.