Bug 131264

Summary: Frequent PluginProcess crashes at libsqlite3.dylib: openDatabase
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: WebKit2Assignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, commit-queue, ike
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed fix none

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.

<rdar://problem/14165329>
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.