Closed Bug 829927 Opened 7 years ago Closed 7 years ago

java.lang.IllegalStateException: Couldn''t read row 0, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetString(Native Method) at upgradeDatabaseFrom12to13

Categories

(Firefox for Android :: Data Providers, defect, critical)

19 Branch
ARM
Android
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Firefox 22
Tracking Status
firefox19 + wontfix
firefox20 + fixed
firefox21 + fixed
firefox22 --- fixed

People

(Reporter: scoobidiver, Assigned: bnicholson)

References

Details

(Keywords: crash, topcrash, Whiteboard: [native-crash][startupcrash])

Crash Data

Attachments

(1 file)

It's #16 top crasher in 19.0b1 and is similar to bug 822575.

Here is a crash report: bp-eb6dd76c-9c27-4cfa-a760-5b7102130111.

java.lang.IllegalStateException: Couldn't read row 0, col 1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.
	at android.database.CursorWindow.nativeGetString(Native Method)
	at android.database.CursorWindow.getString(CursorWindow.java:450)
	at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
	at org.mozilla.firefox_beta.db.BrowserProvider$DatabaseHelper.upgradeDatabaseFrom12to13(BrowserProvider.java:1464)
	at org.mozilla.firefox_beta.db.BrowserProvider$DatabaseHelper.onUpgrade(BrowserProvider.java:1583)
	at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:170)
	at org.mozilla.gecko.db.DBUtils.ensureDatabaseIsNotLocked(DBUtils.java:76)
	at org.mozilla.firefox_beta.db.BrowserProvider.getDatabaseHelperForProfile(BrowserProvider.java:1688)
	at org.mozilla.firefox_beta.db.BrowserProvider.getWritableDatabase(BrowserProvider.java:1738)
	at org.mozilla.firefox_beta.db.BrowserProvider.update(BrowserProvider.java:2116)
	at android.content.ContentProvider$Transport.update(ContentProvider.java:229)
	at android.content.ContentResolver.update(ContentResolver.java:856)
	at org.mozilla.gecko.db.LocalBrowserDB.updateHistoryTitle(LocalBrowserDB.java:255)
	at org.mozilla.gecko.db.BrowserDB.updateHistoryTitle(BrowserDB.java:126)
	at org.mozilla.gecko.GlobalHistory.update(GlobalHistory.java:131)
	at org.mozilla.gecko.Tab$4.run(Tab.java:277)
	at android.os.Handler.handleCallback(Handler.java:605)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:137)
	at org.mozilla.gecko.util.GeckoBackgroundThread.run(GeckoBackgroundThread.java:31)

More reports at:
https://crash-stats.mozilla.com/report/list?signature=java.lang.IllegalStateException%3A+Couldn%27%27t+read+row+0%2C+col+1+from+CursorWindow.++Make+sure+the+Cursor+is+initialized+correctly+before+accessing+data+from+it.+at+android.database.CursorWindow.nativeGetString%28Native+Method%29
Brian, looks like you were the last person to touch upgradeDatabaseFrom12to13(). :)
It's #4 top crasher in the first hours of 19.0.
Keywords: topcrash
More reports also at:
https://crash-stats.mozilla.com/report/list?signature=java.lang.IllegalStateException%3A+Couldn%27%27t+read+row+0%2C+col+1+from+CursorWindow.+Make+sure+the+Cursor+is+initialized+correctly+before+accessing+data+from+it+at+android.database.CursorWindow.getString_native%28Native+Method%29
Crash Signature: [@ java.lang.IllegalStateException: Couldn''t read row 0, col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetString(Native Method)] → [@ java.lang.IllegalStateException: Couldn''t read row 0 col 1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetString(Native Method)] [@ java.lang.IllegalStateExce…
Whiteboard: [native-crash] → [native-crash][startupcrash]
Sending over to you Lucas since bug 791958 and bug 752828 are assigned to you (and this is similarly an issue upon update).

May be reassigned, because I know agal offered some help here.
Assignee: nobody → lucasr.at.mozilla
It looks like people are running into this repeatedly, just like bug 791958:

breakpad=> SELECT version,COUNT(*) as crashes,COUNT(DISTINCT client_crash_date - install_age  * interval '1 second') as installations FROM reports WHERE product='FennecAndroid' AND signature LIKE '%read row 0, col 1 from CursorWindow%' AND utc_day_is(date_processed, '2013-02-20') GROUP BY version;
 version | crashes | installations 
---------+---------+---------------
 19.0    |     507 |           119
(1 row)
Speculative fix. According to http://developer.android.com/reference/android/database/Cursor.html#getString%28int%29, the implementation may throw an exception if the data is null. I think it's possible for the favicon URL to be null, so we should check before calling getString().
Attachment #716263 - Flags: review?(mark.finkle)
Attachment #716263 - Flags: review?(mark.finkle) → review+
This exception is referring to column 1, which should be the value of pageIndex, not the favicon URL. That implies that page_url (FAVICON_PAGE) would have to be null.

Also, both of the columns in the table to be migrated are marked as NOT NULL:

https://hg.mozilla.org/mozilla-central/rev/04390f095c58#l2.42

I think we need to find another culprit.
(In reply to Richard Newman [:rnewman] from comment #7)

> Also, both of the columns in the table to be migrated are marked as NOT NULL:

Ignore that -- was looking at the favicons table and query, not the images table. Concur that this is a likely culprit.
Assignee: lucasr.at.mozilla → bnicholson
Status: NEW → ASSIGNED
Comment on attachment 716263 [details] [diff] [review]
Don't read favicon URL if it's null

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 784086
User impact if declined: crashes on upgrade
Testing completed (on m-c, etc.): none (only happens on upgrade path)
Risk to taking this patch (and alternatives if risky): low risk
String or UUID changes made by this patch: none
Attachment #716263 - Flags: approval-mozilla-beta?
Attachment #716263 - Flags: approval-mozilla-aurora?
Will come back around to approve once this is on trunk, we'll take this asap so it can be landed in time for a potential quick turnaround beta 2 next week.
Blocks: 784086
https://hg.mozilla.org/mozilla-central/rev/2b40ffaf95cb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Attachment #716263 - Flags: approval-mozilla-beta?
Attachment #716263 - Flags: approval-mozilla-beta+
Attachment #716263 - Flags: approval-mozilla-aurora?
Attachment #716263 - Flags: approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.