Bug 137489

Summary: [SOUP] [WK2] WebProcess and NetworkProcess initialization clears cache contents
Product: WebKit Reporter: Sergio Villar Senin <svillar>
Component: WebKit2Assignee: Sergio Villar Senin <svillar>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, gustavo, mrobinson, pnormand
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Sergio Villar Senin 2014-10-07 09:59:39 PDT
The method NetworkProcess::platformInitializeNetworkProcess() creates the SoupCache object and performs the soup_cache_load() to load the index in memory. Loading the index has some side effects like deleting as much resources as needed to get the cache size under the max_size restriction. The problem is that unless soup_cache_set_max_size() is called before soup_cache_load(), the later will use the default cache max size (50Mb IIRC). 

Should you have a different max_size, it won't matter because the cache was already loaded and the resources exceeding the capacity already wiped.
Comment 1 Sergio Villar Senin 2014-10-10 09:44:21 PDT
Actually the same happens with the WebProcess initialization.
Comment 2 Sergio Villar Senin 2014-10-10 09:56:42 PDT
Created attachment 239633 [details]
Patch
Comment 3 Carlos Garcia Campos 2014-10-10 10:13:31 PDT
I guess resources will never be removed then? if load() is the only one doing that
Comment 4 Sergio Villar Senin 2014-10-12 01:56:21 PDT
(In reply to comment #3)
> I guess resources will never be removed then? if load() is the only one doing that

load() is not the one doing that. load() calls soup_cache_entry_insert() which is the one that makes room in the cache if there is not enough disk space to allocate the resource. soup_cache_entry_insert() is called for every single new resource. This means that old resources will be removed at any time once the cache is full.
Comment 5 WebKit Commit Bot 2014-10-12 02:32:12 PDT
Comment on attachment 239633 [details]
Patch

Clearing flags on attachment: 239633

Committed r174639: <http://trac.webkit.org/changeset/174639>
Comment 6 WebKit Commit Bot 2014-10-12 02:32:16 PDT
All reviewed patches have been landed.  Closing bug.