Bug 180722 - REGRESSION (r225789): API tests WKProcessPool.InitialWarmedProcessUsed and WebKit.WebsiteDataStoreCustomPaths are failing
Summary: REGRESSION (r225789): API tests WKProcessPool.InitialWarmedProcessUsed and We...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-12 15:09 PST by Matt Lewis
Modified: 2017-12-15 10:55 PST (History)
6 users (show)

See Also:


Attachments
Patch (18.06 KB, patch)
2017-12-13 09:44 PST, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (17.11 KB, patch)
2017-12-13 10:46 PST, Brady Eidson
no flags Details | Formatted Diff | Diff
Crash caused by first patch (77.25 KB, text/plain)
2017-12-13 15:57 PST, Matt Lewis
no flags Details
Patch (17.26 KB, patch)
2017-12-13 18:20 PST, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Lewis 2017-12-12 15:09:47 PST
Multiple API failures are happening consistently after https://trac.webkit.org/changeset/225789/webkit

WKProcessPool.InitialWarmedProcessUsed
WebKit.WebsiteDataStoreCustomPaths

https://build.webkit.org/builders/Apple%20El%20Capitan%20Release%20WK1%20%28Tests%29/builds/6953/steps/run-api-tests/logs/stdio
Build:
https://build.webkit.org/builders/Apple%20El%20Capitan%20Release%20WK1%20%28Tests%29/builds/6953/steps/run-api-tests/logs/stdio

FAIL WKProcessPool.InitialWarmedProcessUsed

/Volumes/Data/slave/elcapitan-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/InitialWarmedProcessUsed.mm:51
Value of: static_cast<size_t>(1)
  Actual: 1
Expected: [pool _webProcessCount]
Which is: 2


FAIL WebKit.WebsiteDataStoreCustomPaths

/Volumes/Data/slave/elcapitan-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:219
Value of: [WKWebsiteDataStore _defaultDataStoreExists]
  Actual: true
Expected: false
Comment 1 Radar WebKit Bug Importer 2017-12-12 20:24:52 PST
<rdar://problem/36012825>
Comment 2 Brady Eidson 2017-12-13 09:35:38 PST
Enabling SW for API tests caused two changes:
1 - An additional WebProcess exists, though it doesn't host WebPages.
2 - We accidentally create the default WebsiteDataStore even when only a custom store is used.

#1 is resolved with a testing change, and #2 is a real bug to be fixed.
Comment 3 Brady Eidson 2017-12-13 09:44:37 PST
Created attachment 329225 [details]
Patch
Comment 4 Chris Dumez 2017-12-13 09:52:25 PST
Comment on attachment 329225 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=329225&action=review

r=me with comments.

> Source/WebKit/StorageProcess/StorageProcess.cpp:437
> +        parentProcessConnection()->send(Messages::StorageProcessProxy::EstablishWorkerContextConnectionToStorageProcessForExplicitSession(*sessionID), 0);

There is no reason we cannot have a single IPC message that takes in a std::optional<PAL::SessionID>, is there?

> Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm:447
> +    bool serviceWorkerProcessWasFound = false;

I think this whole block should be protected by #if !ASSERT_DISABLED.

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:60
> +    static NeverDestroyed<HashMap<PAL::SessionID, WebsiteDataStore*>> map;

We may want to add a RELEASE_ASSERT to make sure this is always called on the main thread. I know how clients like to use our API from various threads and such HashMap could get corrupted.

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:99
> +    ASSERT(allDataStores().get(m_sessionID) == this);

remove() returns a boolean, I would have been more efficient to ASSERT_UNUSED(wasRemoved, wasRemoved); after the remove() call.
Comment 5 Brady Eidson 2017-12-13 10:37:02 PST
(In reply to Chris Dumez from comment #4)
> Comment on attachment 329225 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=329225&action=review
> 
> r=me with comments.
> 
> > Source/WebKit/StorageProcess/StorageProcess.cpp:437
> > +        parentProcessConnection()->send(Messages::StorageProcessProxy::EstablishWorkerContextConnectionToStorageProcessForExplicitSession(*sessionID), 0);
> 
> There is no reason we cannot have a single IPC message that takes in a
> std::optional<PAL::SessionID>, is there?

While debugging I immediately found it useful to see a different message name here. (This is occasionally true throughout WK2)

> 
> > Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm:447
> > +    bool serviceWorkerProcessWasFound = false;
> 
> I think this whole block should be protected by #if !ASSERT_DISABLED.

Yah, probably true.

> 
> > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:60
> > +    static NeverDestroyed<HashMap<PAL::SessionID, WebsiteDataStore*>> map;
> 
> We may want to add a RELEASE_ASSERT to make sure this is always called on
> the main thread. I know how clients like to use our API from various threads
> and such HashMap could get corrupted.

Sure.

> 
> > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:99
> > +    ASSERT(allDataStores().get(m_sessionID) == this);
> 
> remove() returns a boolean, I would have been more efficient to
> ASSERT_UNUSED(wasRemoved, wasRemoved); after the remove() call.

k
Comment 6 Brady Eidson 2017-12-13 10:39:22 PST
(In reply to Brady Eidson from comment #5)
> (In reply to Chris Dumez from comment #4)
> > 
> > > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:99
> > > +    ASSERT(allDataStores().get(m_sessionID) == this);
> > 
> > remove() returns a boolean, I would have been more efficient to
> > ASSERT_UNUSED(wasRemoved, wasRemoved); after the remove() call.
> 
> k

Actually, still prefer this version as it verifies not only that the entry exists, but that the entry is "this"
Comment 7 Brady Eidson 2017-12-13 10:46:11 PST
Created attachment 329233 [details]
Patch
Comment 8 WebKit Commit Bot 2017-12-13 12:20:22 PST
Comment on attachment 329233 [details]
Patch

Clearing flags on attachment: 329233

Committed r225864: <https://trac.webkit.org/changeset/225864>
Comment 9 WebKit Commit Bot 2017-12-13 12:20:23 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Matt Lewis 2017-12-13 15:45:40 PST
This patch caused the layout test step in the testers to crash, fail, and unable to run.

https://build.webkit.org/results/Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/r225872%20(1241)/results.html
https://build.webkit.org/builders/Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/builds/1241

Link to crash: https://build.webkit.org/results/Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/r225872%20(1241)/accessibility/attachment-element-crash-log.txt


stderr:


LEAK: 1 WebPage
LEAK: 1 WebFrame
LEAK: 69 RenderObject
LEAK: 4191 BidiRun
LEAK: 9 Page
LEAK: 9 Frame
LEAK: 109 CachedResource
LEAK: 630 WebCoreNode
ASSERTION FAILED: result.isNewEntry
/Volumes/Data/slave/highsierra-debug/build/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp(82) : WebKit::WebsiteDataStore::WebsiteDataStore(WebKit::WebsiteDataStore::Configuration, PAL::SessionID)
1   0x10fb48c7d WTFCrash
2   0x1137648a7 WebKit::WebsiteDataStore::WebsiteDataStore(WebKit::WebsiteDataStore::Configuration, PAL::SessionID)
3   0x1137646ed WebKit::WebsiteDataStore::WebsiteDataStore(WebKit::WebsiteDataStore::Configuration, PAL::SessionID)
4   0x1137646a2 WebKit::WebsiteDataStore::create(WebKit::WebsiteDataStore::Configuration, PAL::SessionID)
5   0x112a807e7 API::WebsiteDataStore::WebsiteDataStore(WebKit::WebsiteDataStore::Configuration, PAL::SessionID)
6   0x112a8043d API::WebsiteDataStore::WebsiteDataStore(WebKit::WebsiteDataStore::Configuration, PAL::SessionID)
7   0x112a8062b API::WebsiteDataStore::createLegacy(WebKit::WebsiteDataStore::Configuration)
8   0x11369da11 WebKit::WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration&)
9   0x11369c0fd WebKit::WebProcessPool::WebProcessPool(API::ProcessPoolConfiguration&)
10  0x11369c068 WebKit::WebProcessPool::create(API::ProcessPoolConfiguration&)
11  0x1138b9771 WKContextCreateWithConfiguration
12  0x10e4f88e7 WTR::TestController::generatePageConfiguration(OpaqueWKContextConfiguration const*)
13  0x10e4f96e0 WTR::TestController::createWebViewWithOptions(WTR::TestOptions const&)
14  0x10e4fa9ea WTR::TestController::ensureViewSupportsOptionsForTest(WTR::TestInvocation const&)
15  0x10e500d1f WTR::TestController::configureViewForTest(WTR::TestInvocation const&)
16  0x10e523dee WTR::TestInvocation::invoke()
17  0x10e504d5d WTR::TestController::runTest(char const*)
18  0x10e505ed4 WTR::TestController::runTestingServerLoop()
19  0x10e4f6836 WTR::TestController::run()
20  0x10e4f61ba WTR::TestController::TestController(int, char const**)
21  0x10e4f69f3 WTR::TestController::TestController(int, char const**)
22  0x10e4d5def main
23  0x7fff584d2115 start
Comment 11 Matt Lewis 2017-12-13 15:57:45 PST
Created attachment 329276 [details]
Crash caused by first patch

Attaching crash
Comment 12 Matt Lewis 2017-12-13 15:58:42 PST
Reverted r225864 for reason:

This caused the Layout test step to crash out on Debug testers

Committed r225877: <https://trac.webkit.org/changeset/225877>
Comment 13 Brady Eidson 2017-12-13 17:08:10 PST
(In reply to Matt Lewis from comment #10)
> This patch caused the layout test step in the testers to crash, fail, and
> unable to run.
> 
> https://build.webkit.org/results/
> Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/r225872%20(1241)/results.html
> https://build.webkit.org/builders/
> Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/builds/1241
> 
> Link to crash:
> https://build.webkit.org/results/
> Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/r225872%20(1241)/accessibility/
> attachment-element-crash-log.txt
> 

Why did EWS not catch that? *sigh*
Comment 14 Brady Eidson 2017-12-13 17:41:45 PST
Easy to reproduce locally with:

run-webkit-tests aria-used-on-image-maps.html attachment-element.html

Testing a fix locally before uploading.
Comment 15 Brady Eidson 2017-12-13 18:20:04 PST
Created attachment 329303 [details]
Patch
Comment 16 Brady Eidson 2017-12-13 18:21:03 PST
This new patch is the same, but only tracks non-default data stores.

(Multiple data store objects can be made to represent the default data store, but that's not true for non-default ones)
Comment 17 Ryan Haddad 2017-12-14 09:41:55 PST
Can this patch get landed as-is or does it need another review?
Comment 18 Chris Dumez 2017-12-14 09:42:48 PST
(In reply to Ryan Haddad from comment #17)
> Can this patch get landed as-is or does it need another review?

Still r=me.
Comment 19 Ryan Haddad 2017-12-14 14:36:36 PST
Comment on attachment 329303 [details]
Patch

Marking cq+ to get the bots back to green.
Comment 20 WebKit Commit Bot 2017-12-14 14:57:18 PST
Comment on attachment 329303 [details]
Patch

Clearing flags on attachment: 329303

Committed r225935: <https://trac.webkit.org/changeset/225935>
Comment 21 WebKit Commit Bot 2017-12-14 14:57:19 PST
All reviewed patches have been landed.  Closing bug.
Comment 22 Brady Eidson 2017-12-14 20:06:47 PST
Yah sorry I was AFK most the day, I meant to cq+ once EWS was green (It was taking its sweet time last night)

Thanks for doing all the right things!
Comment 23 Ryan Haddad 2017-12-15 09:15:07 PST
One of the API tests is still failing after the fix:
FAIL WebKit.WebsiteDataStoreCustomPaths

/Volumes/Data/slave/elcapitan-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:219
Value of: [WKWebsiteDataStore _defaultDataStoreExists]
  Actual: true
Expected: false

I can reproduce the failure locally on High Sierra.
Comment 24 Ryan Haddad 2017-12-15 10:55:54 PST
(In reply to Ryan Haddad from comment #23)
> One of the API tests is still failing after the fix:
> FAIL WebKit.WebsiteDataStoreCustomPaths
> 
> /Volumes/Data/slave/elcapitan-release/build/Tools/TestWebKitAPI/Tests/
> WebKitCocoa/WebsiteDataStoreCustomPaths.mm:219
> Value of: [WKWebsiteDataStore _defaultDataStoreExists]
>   Actual: true
> Expected: false
> 
> I can reproduce the failure locally on High Sierra.
Filed https://bugs.webkit.org/show_bug.cgi?id=180870