Bug 131264 - Frequent PluginProcess crashes at libsqlite3.dylib: openDatabase
Summary: Frequent PluginProcess crashes at libsqlite3.dylib: openDatabase
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
Keywords: InRadar
Depends on:
Reported: 2014-04-05 00:50 PDT by Alexey Proskuryakov
Modified: 2014-04-05 17:51 PDT (History)
3 users (show)

See Also:

proposed fix (5.46 KB, patch)
2014-04-05 01:02 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2014-04-05 00:50:22 PDT
We use WKCopyFoundationCacheDirectory() to pass NSURL_CACHE_DIR parameter to PluginProcess sandbox. But calling WKCopyFoundationCacheDirectory() implicitly instantiates a shared cache, which is then created on disk on a secondary thread. Our code then uses setenv to change DIRHELPER_USER_DIR_SUFFIX, and CFNetwork uses getenv, which results in a crash if timing is right.

We really shouldn't be creating a cache just to find out what its path will be.

Comment 1 Alexey Proskuryakov 2014-04-05 01:02:23 PDT
Created attachment 228666 [details]
proposed fix

As a side effect, this will change plug-in NSURL cache location from ~/Library/Caches/com.apple.PluginProcess to /var/folders/blah/blah/C/com.apple.PluginProcess for most users. CFNetwork uses complicated logic to fall back to the latter if the former isn't appropriate (namely, for network home directory users).

It doesn't make much sense to try replicating this logic, as we can just always use the latter directory that works for everyone. CFNetwork behavior is of course subject to change, so trying to approximate it is futile.

Perhaps we should have separate caches for different plug-ins (or even separate them by UI process bundle identifier too), but this patch doesn't change this aspect of the behavior.
Comment 2 WebKit Commit Bot 2014-04-05 17:51:03 PDT
Comment on attachment 228666 [details]
proposed fix

Clearing flags on attachment: 228666

Committed r166845: <http://trac.webkit.org/changeset/166845>
Comment 3 WebKit Commit Bot 2014-04-05 17:51:05 PDT
All reviewed patches have been landed.  Closing bug.