The problem here is that Places (along with lots of other places in our code) still creates and uses synchronous database statements. SQLite is only threadsafe because it serializes all access to a database connection (this is unlikely to change any time soon).
To make this problem worse, every time we "fix" an area that does this, we end up putting more work on the background thread, which increases the likelihood that the remaining places that need to acquire the mutex on the main thread will encounter contention for the mutex.
Some of you might recall we hit this problem in the run-up to Firefox 4 as well (November/December of last year), and it caused Marco and I to have to reachitect a bunch of stuff in Places for a few months in order to work around it. Until Firefox removes all uses of the synchronous Storage API from the main thread, this issue will keep rearing it's head. (When that happens we can actually use SQLite in a way that stops using mutexs and will likely speed it up too.)
Shawn Wilsher :sdwilsh 2011-09-18 12:33:22 PDT
The problem here is that Places (along with lots of other places in our code) still creates and uses synchronous database statements. SQLite is only threadsafe because it serializes all access to a database connection (this is unlikely to change any time soon).
To make this problem worse, every time we "fix" an area that does this, we end up putting more work on the background thread, which increases the likelihood that the remaining places that need to acquire the mutex on the main thread will encounter contention for the mutex.
Some of you might recall we hit this problem in the run-up to Firefox 4 as well (November/December of last year), and it caused Marco and I to have to reachitect a bunch of stuff in Places for a few months in order to work around it. Until Firefox removes all uses of the synchronous Storage API from the main thread, this issue will keep rearing it's head. (When that happens we can actually use SQLite in a way that stops using mutexs and will likely speed it up too.)