Closed
Bug 856739
Opened 12 years ago
Closed 12 years ago
AwesomeBar.onDestroy does DB access on the main thread
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(firefox21+ fixed, firefox22+ fixed, firefox23 fixed)
RESOLVED
FIXED
Firefox 23
People
(Reporter: kats, Assigned: mfinkle)
References
Details
Attachments
(1 file, 1 obsolete file)
3.20 KB,
patch
|
lucasr
:
review+
bajaj
:
approval-mozilla-aurora+
bajaj
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
From bug 856011 comment 0:
android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase.java:375)
android.database.sqlite.SQLiteProgram.close(SQLiteProgram.java:291)
android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:133)
android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:502)
android.database.CursorWrapper.close(CursorWrapper.java:45)
android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:1355)
android.database.CursorWrapper.close(CursorWrapper.java:45)
org.mozilla.gecko.AllPagesTab.destroy(AllPagesTab.java:158)
org.mozilla.gecko.AwesomeBarTabs.destroy(AwesomeBarTabs.java:299)
org.mozilla.gecko.AwesomeBar.onDestroy(AwesomeBar.java:488)
Similar stacks are in bug 856015 and bug 856129.
Assignee | ||
Comment 1•12 years ago
|
||
I found that the BookmarksTab code did the same thing, so I changed that too. In AllPagesTab.destroy, I rearranged the code so the cursor closed happened last. There is a null adapter check that could return early, which made the message clean up code not be called.
Assignee: nobody → mark.finkle
Attachment #732306 -
Flags: review?(lucasr.at.mozilla)
Comment 2•12 years ago
|
||
Comment on attachment 732306 [details] [diff] [review]
patch
Review of attachment 732306 [details] [diff] [review]:
-----------------------------------------------------------------
The code reordering looks fine but moving code to close the cursor to the background thread looks suspicious: you're postponing an operation on the state of an object that is being destroyed. AFAIK, it's totally fine to close the cursor on main thread. I'd be more confident to r+ this patch if we knew for sure what's causing this bug. Have you confirmed that this patch fixes the crash?
Reporter | ||
Comment 3•12 years ago
|
||
Based on what sriram found in bug 856767 I think here also we should disconnect the adapter and/or cursor from the view before doing the close.
Reporter | ||
Comment 4•12 years ago
|
||
Attachment #732306 -
Flags: review?(lucasr.at.mozilla) → review-
Assignee | ||
Comment 5•12 years ago
|
||
This patch disconnects the adapter from the view before closing the cursor. It's a bit tricky though. I had to stop using "getCursorAdapter" since that method never returns null. Same for "getListView".
Otherwise this should be just like Sriram's patch.
Attachment #732306 -
Attachment is obsolete: true
Attachment #734692 -
Flags: review?(lucasr.at.mozilla)
Comment 6•12 years ago
|
||
Comment on attachment 734692 [details] [diff] [review]
patch v2
Review of attachment 734692 [details] [diff] [review]:
-----------------------------------------------------------------
I'm mixed about this patch. I really don't like the fact that part of of the destroy logic is now done asynchronously. But it seems like the best possible thing to try for now. Please add a comment with more background info about why closing a cursor in UI thread might cause DB lock issues (on pre-ICS it seems).
::: mobile/android/base/awesomebar/BookmarksTab.java
@@ +95,5 @@
> public void destroy() {
> + // Can't use getters for adapter. It will create one if null.
> + if (mCursorAdapter != null && mView != null) {
> + ListView list = (ListView)mView;
> + list.setAdapter(null);
Don't you have to set mCursorAdapter to null somewhere?
Attachment #734692 -
Flags: review?(lucasr.at.mozilla) → review+
Assignee | ||
Comment 7•12 years ago
|
||
Pushed with comments added:
https://hg.mozilla.org/integration/mozilla-inbound/rev/39fbc0bcfa1f
We don't seem to need to null out mCursorAdapter. Just close the cursor.
Comment 8•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 23
Assignee | ||
Comment 9•12 years ago
|
||
Comment on attachment 734692 [details] [diff] [review]
patch v2
[Approval Request Comment]
Bug caused by (feature/regressing bug #):
User impact if declined: Can cause DB hangs and locks
Testing completed (on m-c, etc.): on m-c
Risk to taking this patch (and alternatives if risky): some risk, but we should be able to manage it
String or IDL/UUID changes made by this patch: none
Attachment #734692 -
Flags: approval-mozilla-beta?
Attachment #734692 -
Flags: approval-mozilla-aurora?
Comment 10•12 years ago
|
||
Approving per, https://bugzilla.mozilla.org/show_bug.cgi?id=843005#c10
Updated•12 years ago
|
Attachment #734692 -
Flags: approval-mozilla-beta?
Attachment #734692 -
Flags: approval-mozilla-beta+
Attachment #734692 -
Flags: approval-mozilla-aurora?
Attachment #734692 -
Flags: approval-mozilla-aurora+
Updated•12 years ago
|
status-firefox21:
--- → affected
status-firefox22:
--- → affected
tracking-firefox21:
--- → +
tracking-firefox22:
--- → +
Assignee | ||
Comment 11•12 years ago
|
||
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•