Bug 56144

Summary: DatabaseTracker threading model should be changed to use message passing.
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: adauria, andersca, ap, dimich, ericu, jorlow, levin, michaeln
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Brady Eidson 2011-03-10 14:11:35 PST
DatabaseTracker threading model should be changed to use message passing.

The original model tried carefully to guard shared data with locks, etc.

In our experience it has been working fine and there's no known outstanding issues with it.  But the model itself fragile to work with, and we could make it more robust by transitioning to a message passing model.
Comment 1 Michael Nordman 2011-03-10 16:41:25 PST
There have been deadlocks, races, and crashes related to how the db system handles multi-threading... and then bringing the system up in the context of workers was extra challenging as well.

Some of the grief stems from the synchronous APIs exposed by the 'tracker' to the embedder. Satisfying those sync requests is troublesome. Altering those webkit level interfaces to be async would provide a little breathing room.
Comment 2 Brady Eidson 2011-03-10 16:45:53 PST
(In reply to comment #1)
> 
> Some of the grief stems from the synchronous APIs exposed by the 'tracker' to the embedder. Satisfying those sync requests is troublesome. Altering those webkit level interfaces to be async would provide a little breathing room.

The sync interfaces have shipped, and as a policy with the WebKit project we don't break backwards compatibility without at least a deprecation period.

The first step to resolving that headache would be to add a new async interface, which would allow us to deprecate the old interface.
Comment 3 Michael Nordman 2011-03-11 12:26:27 PST
Kinuko and David Levin had been talking about adding better infrastructure for thread message passing to webcore. I don't think that talk has translated into code yet, but maybe after there's some improved infrastructure in place it would be a good time to migrate the database tracker (and the database stuff in general) over.
Comment 4 Brady Eidson 2011-03-11 12:37:20 PST
Anders, are we still exploring moving CoreIPC to WTF?

It supports threaded mode, and It could be used here pretty painlessly, I imagine.
Comment 5 Anders Carlsson 2011-03-11 12:51:14 PST
(In reply to comment #4)
> Anders, are we still exploring moving CoreIPC to WTF?

Yes.

> It supports threaded mode, and It could be used here pretty painlessly, I imagine.

It might be a bit overkill for simple message passing since it serializes/deserializes data that might not be needed.