Closed Bug 844895 Opened 11 years ago Closed 11 years ago

java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/<profile>.webapp<n>/browser.db at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java)

Categories

(Firefox for Android Graveyard :: General, defect)

22 Branch
ARM
Android
defect
Not set
critical

Tracking

(firefox19 unaffected, firefox20 unaffected, firefox21 unaffected, firefox22+ verified)

VERIFIED FIXED
Firefox 22
Tracking Status
firefox19 --- unaffected
firefox20 --- unaffected
firefox21 --- unaffected
firefox22 + verified

People

(Reporter: scoobidiver, Assigned: wesj)

References

Details

(4 keywords, Whiteboard: [native-crash], A4A)

Crash Data

Attachments

(3 files)

It started in 22.0a1/20130224. The regression range is:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=08a034e1d43a&tochange=195e706140d1
I suspect bug 843234 or bug 829927.

Here is a crash report: bp-9ada190f-d67d-4c1b-beee-507b52130225.

java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/kbzba029.webapp0/browser.db
	at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
	at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1534)
	at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1514)
	at org.mozilla.fennec.db.BrowserProvider.updateFaviconIdsForUrl(BrowserProvider.java:2912)
	at org.mozilla.fennec.db.BrowserProvider.insertFavicon(BrowserProvider.java:2946)
	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper.createFavicon(BrowserProvider.java:1115)
	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper.access$100(BrowserProvider.java:374)
	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper$2.run(BrowserProvider.java:1080)
	at android.os.Handler.handleCallback(Handler.java:725)
	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/query/query?product=FennecAndroid&query_search=signature&query_type=contains&query=android.database.sqlite.SQLiteClosable.acquireReference&do_query=1
Crash Signature: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/ezb2f8d7.webapp0/browser.db at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java) ] → java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/ezb2f8d7.webapp0/browser.db at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java) ] [@ jav…
Summary: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/<profile>.webapp0/browser.db at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java) → java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/<profile>.webapp<n>/browser.db at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java)
It has spiked one build later. The regression range for the spike is:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=195e706140d1&tochange=c233837cce08
Keywords: topcrash
Starting this off with wesj to investigate/reassign, since bug 843234 is the most likely culprit. Bug 829927 landed to Aurora/Beta as well, but this crash hasn't spiked up on those channels.
Assignee: nobody → wjohnston
There are no crashes in 22.0a1/20130228. In case it's fixed, the working range is:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=e7632ab657e5&tochange=b0e08db3bc2a
It shows up again 22.0a1/20130103.
(In reply to Scoobidiver from comment #4)
> It shows up again 22.0a1/20130103.
I meant 22.0a1/20130301.

There are again no crashes in 22.0a1/20130302.
I have some STR

i) Nightly (03/04)
ii) Install PipesPuzzle, Pacman Canvas (Alpha)
iii) Load PipesPuzzle let it load, switch to home-screen, launch Pacman Canvas

W/dalvikvm(32601): threadid=10: thread exiting with uncaught exception (group=0x40fc4930)
E/GeckoAppShell(32601): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 758 ("GeckoBackgroundThread")
E/GeckoAppShell(32601): java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/zw7atrpl.webapp2/browser.db
E/GeckoAppShell(32601): 	at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
E/GeckoAppShell(32601): 	at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1534)
E/GeckoAppShell(32601): 	at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1514)
E/GeckoAppShell(32601): 	at org.mozilla.fennec.db.BrowserProvider.updateFaviconIdsForUrl(BrowserProvider.java:2915)
E/GeckoAppShell(32601): 	at org.mozilla.fennec.db.BrowserProvider.insertFavicon(BrowserProvider.java:2949)
E/GeckoAppShell(32601): 	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper.createFavicon(BrowserProvider.java:1118)
E/GeckoAppShell(32601): 	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper.access$100(BrowserProvider.java:375)
E/GeckoAppShell(32601): 	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper$2.run(BrowserProvider.java:1083)
E/GeckoAppShell(32601): 	at android.os.Handler.handleCallback(Handler.java:725)
E/GeckoAppShell(32601): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoAppShell(32601): 	at android.os.Looper.loop(Looper.java:137)
E/GeckoAppShell(32601): 	at org.mozilla.gecko.util.GeckoBackgroundThread.run(GeckoBackgroundThread.java:32)
Keywords: reproducible
Raw logcat - https://bugzilla.mozilla.org/attachment.cgi?id=724399

STR

i) Install Twitter from Firefox Marketplace
ii) Launch Twitter from the Android

D/GeckoDBUtils( 6057): Database is locked, trying to kill any zombie processes: /data/data/org.mozilla.fennec/files/mozilla/ki37kaux.webapp0/browser.db

I/Process ( 6057): Sending signal. PID: 6116 SIG: 9
I/Process ( 6057): Sending signal. PID: 6125 SIG: 9
I/Process ( 6057): Sending signal. PID: 6256 SIG: 9

W/dalvikvm( 6057): threadid=10: thread exiting with uncaught exception (group=0x40c63930)
E/GeckoAppShell( 6057): >>> REPORTING UNCAUGHT EXCEPTION FROM THREAD 365 ("GeckoBackgroundThread")
E/GeckoAppShell( 6057): java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/org.mozilla.fennec/files/mozilla/ki37kaux.webapp0/browser.db
E/GeckoAppShell( 6057): 	at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
E/GeckoAppShell( 6057): 	at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1534)
E/GeckoAppShell( 6057): 	at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1514)
E/GeckoAppShell( 6057): 	at org.mozilla.fennec.db.BrowserProvider.updateFaviconIdsForUrl(BrowserProvider.java:2911)
E/GeckoAppShell( 6057): 	at org.mozilla.fennec.db.BrowserProvider.insertFavicon(BrowserProvider.java:2945)
E/GeckoAppShell( 6057): 	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper.createFavicon(BrowserProvider.java:1118)
E/GeckoAppShell( 6057): 	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper.access$100(BrowserProvider.java:375)
E/GeckoAppShell( 6057): 	at org.mozilla.fennec.db.BrowserProvider$DatabaseHelper$2.run(BrowserProvider.java:1083)
E/GeckoAppShell( 6057): 	at android.os.Handler.handleCallback(Handler.java:725)
E/GeckoAppShell( 6057): 	at android.os.Handler.dispatchMessage(Handler.java:92)
E/GeckoAppShell( 6057): 	at android.os.Looper.loop(Looper.java:137)
E/GeckoAppShell( 6057): 	at org.mozilla.gecko.util.GeckoBackgroundThread.run(GeckoBackgroundThread.java:32)
E/Gecko   ( 6057): mozalloc_abort: Redirecting call to abort() to mozalloc_abort
This is preventing the ability to launch web-apps while the browser is open.
Whiteboard: [native-crash] → [native-crash], A4A
Ok this works for me today on 03/14 (Alcatel One Touch) and my Nexus 4 ...
Spoke too soon,

Fresh profile on my Galaxy Nexus, installed and launched Wired, and crashed
Seems to be more reproducible when launching two apps together quickly
100% reproducible on my Galaxy Nexus and Nexus 4

STR: New profile (Nightly) → visit the Firefox Marketplace → Install Twitter → hit "Launch" or launch from the Android home-screen or via notification
Raw log from install and launch on my Galaxy Nexus
I cant reproduce this on my S4 (but others can). Can we get a regression window?
Last working good build on m-c

20130307030926
http://hg.mozilla.org/mozilla-central/rev/ee4879719f78

Unfortunately bug 849539 from builds afterwards is obscuring attempts to narrow this

First known bad build on m-c that has lets you get further in web-app startup with bug 849539

20130312031046
http://hg.mozilla.org/mozilla-central/rev/7433bc4545c9

Kind of big, anything stick out? http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=ee4879719f78&tochange=7433bc4545c9
(In reply to Aaron Train [:aaronmt] from comment #18)
> Last working good build on m-c
> 20130307030926
With your Twitter STR but it showed up before in 20130224031053 (see bp-fded8d3e-8750-4793-94b5-ea8e42130224). See also your STR of comment 6.
100% reproducible on the Asus Transformer TF201 (Android 4.1.1), same STR (new profile, install and launch Twitter)
(In reply to Scoobidiver from comment #19)
> (In reply to Aaron Train [:aaronmt] from comment #18)
> > Last working good build on m-c
> > 20130307030926
> With your Twitter STR but it showed up before in 20130224031053 (see
> bp-fded8d3e-8750-4793-94b5-ea8e42130224). See also your STR of comment 6.

Yep; Wes thought on Friday that this might very well be from bug 843234.
Blocks: 843234
Whiteboard: [native-crash], A4A → [native-crash], A4A?
Attached patch PatchSplinter Review
Moved from the original bug (850645). Quoting from there:

"I think the problem here is that SqliteDBConnection implements its own ref counting. When the db moves out of scope in the first thread, we move its refcount to zero. When the background thread tries to use the safe db reference to create favicons, it fails here:

http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/database/sqlite/SQLiteClosable.java#52

This just forces us to acquire a fresh db reference in the favicon creation code. Alternatively, we could play with calling acquireReference ourselves as an alternative."
Attachment #727325 - Flags: review?(lucasr.at.mozilla)
Attachment #727325 - Flags: review?(lucasr.at.mozilla) → review+
Whiteboard: [native-crash], A4A? → [native-crash], A4A
https://hg.mozilla.org/mozilla-central/rev/6e34c80ad338
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: