Last Comment Bug 743635 - B2G SMS database initialization accesses Directory Provider off the main thread
: B2G SMS database initialization accesses Directory Provider off the main thread
Product: Core
Classification: Components
Component: DOM: Device Interfaces (show other bugs)
: Trunk
: ARM Gonk (Firefox OS)
: -- normal (vote)
: mozilla14
Assigned To: Philipp von Weitershausen [:philikon]
: Andrew Overholt [:overholt]
Depends on:
Blocks: 712809
  Show dependency treegraph
Reported: 2012-04-09 03:34 PDT by Philipp von Weitershausen [:philikon]
Modified: 2012-04-12 10:05 PDT (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

v1 (1.03 KB, patch)
2012-04-09 03:38 PDT, Philipp von Weitershausen [:philikon]
mwu.code: review+
Details | Diff | Splinter Review
v2 (1.65 KB, patch)
2012-04-10 17:26 PDT, Philipp von Weitershausen [:philikon]
no flags Details | Diff | Splinter Review

Description Philipp von Weitershausen [:philikon] 2012-04-09 03:34:38 PDT
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.
Comment 1 Philipp von Weitershausen [:philikon] 2012-04-09 03:38:26 PDT
Created attachment 613261 [details] [diff] [review]
Comment 2 Michael Wu [:mwu] 2012-04-09 03:46:55 PDT
E/GeckoConsole(  108): Attempt to use JS function on a different thread calling nsIDirectoryServiceProvider.getFile. JS objects may not be shared across threads
Comment 3 Philipp von Weitershausen [:philikon] 2012-04-09 18:47:07 PDT
Comment 5 :Ehsan Akhgari 2012-04-10 13:07:36 PDT
Backout merged:
Comment 6 Philipp von Weitershausen [:philikon] 2012-04-10 17:26:19 PDT
Created attachment 613832 [details] [diff] [review]

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?
Comment 7 Philipp von Weitershausen [:philikon] 2012-04-10 19:51:33 PDT
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.
Comment 8 Philipp von Weitershausen [:philikon] 2012-04-10 19:52:46 PDT
Comment on attachment 613832 [details] [diff] [review]

(Canceling feedback request, got feedback from mwu over IRC. Will commit this patch as it already has r+.)
Comment 9 Philipp von Weitershausen [:philikon] 2012-04-10 22:57:09 PDT

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