B2G SMS database initialization accesses Directory Provider off the main thread

RESOLVED FIXED in mozilla14

Status

()

Core
DOM: Device Interfaces
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: philikon, Assigned: philikon)

Tracking

Trunk
mozilla14
ARM
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

On Gonk ICS we're seeing an interesting race condition in the emulator: the B2G SMS database service is initialized at startup and immediately initializes an IndexedDB instance. IndexedDB happens to query the Directory Service for ProfD *off the main thread*. This usually works out fine so long as the Directory Service's cache has been primed (e.g. something has already queried for ProfD). In this case, however, we're seeing that the IndexedDB thread is racing the main thread and fails to look up ProfD.
Created attachment 613261 [details] [diff] [review]
v1
Assignee: nobody → philipp
Attachment #613261 - Flags: review?(mwu)

Comment 2

5 years ago
E/GeckoConsole(  108): Attempt to use JS function on a different thread calling nsIDirectoryServiceProvider.getFile. JS objects may not be shared across threads

Updated

5 years ago
Attachment #613261 - Flags: review?(mwu) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c1ede9f0319e
https://hg.mozilla.org/mozilla-central/rev/c1ede9f0319e
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
Backout merged: https://hg.mozilla.org/mozilla-central/rev/a235528adace
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Created attachment 613832 [details] [diff] [review]
v2

Now with the proper Services.jsm import. The missing import was preventing the SmsDatabaseService from initializing the database, so it kind of fixed the freezing problem, but not in a very useful way.

mwu, would you mind testing this new patch with the missing import added, to see if it still fixes the problem?
Attachment #613261 - Attachment is obsolete: true
Attachment #613832 - Flags: feedback?(mwu)
Turns out, the provided patch doesn't fix the freeze, but it *does* fix the off-thread error. So I'm morphing this bug to just deal with that and filed the cloned bug 744300 to deal with the freeze.
Summary: B2G SMS database initialization freezes I/O thread → B2G SMS database initialization accesses Directory Provider off the main thread
Comment on attachment 613832 [details] [diff] [review]
v2

(Canceling feedback request, got feedback from mwu over IRC. Will commit this patch as it already has r+.)
Attachment #613832 - Flags: feedback?(mwu)
https://hg.mozilla.org/integration/mozilla-inbound/rev/47577c0fd029
https://hg.mozilla.org/mozilla-central/rev/47577c0fd029
Status: REOPENED → RESOLVED
Last Resolved: 5 years ago5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.