Bug 168171 - [GTK][WPE] All resource load statistics tests added in r212183 crash in GTK bots, timeout in GTK and WPE bots since r219049
Summary: [GTK][WPE] All resource load statistics tests added in r212183 crash in GTK b...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Charlie Turner
URL:
Keywords: Gtk, InRadar, LayoutTestFailure
Depends on:
Blocks:
 
Reported: 2017-02-11 09:05 PST by Carlos Garcia Campos
Modified: 2017-10-05 23:49 PDT (History)
11 users (show)

See Also:


Attachments
Patch (1.99 KB, patch)
2017-07-11 08:58 PDT, Charlie Turner
no flags Details | Formatted Diff | Diff
Patch (50.24 KB, patch)
2017-10-03 10:08 PDT, Carlos Garcia Campos
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews112 for mac-elcapitan (1.95 MB, application/zip)
2017-10-03 14:08 PDT, Build Bot
no flags Details
Fix the build (50.21 KB, patch)
2017-10-04 00:44 PDT, Carlos Garcia Campos
cdumez: review-
Details | Formatted Diff | Diff
Patch (40.90 KB, patch)
2017-10-05 01:47 PDT, Carlos Garcia Campos
cdumez: review+
cdumez: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (49.22 KB, patch)
2017-10-05 10:39 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch for landing (49.23 KB, patch)
2017-10-05 10:41 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2017-02-11 09:05:50 PST
It's crashing the UI process in ResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain when calling HashMap::ensure(). It's weird, maybe it's yet another issue that only happens with GCC.
Comment 1 John Wilander 2017-02-11 10:57:50 PST
Sorry about that. Are you able to mark them as skipped for now? Thanks!
Comment 2 John Wilander 2017-02-11 11:26:03 PST
The feature is disabled by default as can be seen in the test cases' call to enable it through internals so you shouldn't risk anything by skipping the tests for now. We'll have to look for the root cause.
Comment 3 Carlos Garcia Campos 2017-02-11 23:05:29 PST
I marked them as crashing in GTK+ expectations. I spent some time debugging it but couldn't find anything, that's why I thought it could be a compiler issue. Also tried different approaches, copying the temporary string, using add instead of ensure and some other things, and it always crashed when adding the item to the HashMap.
Comment 4 John Wilander 2017-02-11 23:23:01 PST
Thanks! I'll see what we can do next week. I'm not an expert on the differences in the two compilers but I have come across certain compiler errors specific to GTK and Efl for this part of the code. I believe it was an implicit this-pointer in a lambda that confused GCC.
Comment 5 Michael Catanzaro 2017-07-06 21:14:25 PDT
These tests are now all timing out instead of crashing. So we will probably need to fix the timeout in order to get them crashing again in order to fix the crash. The timeouts started somewhere between r219010 and r219065, inclusive. Unfortunately that's a huge range as our test bot has been having memory issues recently.

The failures look like this:

--- /home/slave/webkitgtk/gtk-linux-64-release-tests/build/layout-test-results/http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-expected.txt
+++ /home/slave/webkitgtk/gtk-linux-64-release-tests/build/layout-test-results/http/tests/loading/resourceLoadStatistics/classify-as-non-prevalent-based-on-mixed-statistics-actual.txt
@@ -4,5 +4,5 @@
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
-PASS Host did not get classified as prevalent resource.
+FAIL: Timed out waiting for notifyDone to be called

Updating expectations accordingly.
Comment 6 Michael Catanzaro 2017-07-06 21:20:21 PDT
Aha, the WPE bot caught it! They regressed in r219049 "Replace ResourceLoadStatisticsStore C API with Cocoa SPI".
Comment 7 Michael Catanzaro 2017-07-06 21:26:06 PDT
Looks like the TestController implementation for non-Cocoa platforms was purposefully removed. We'll have to implement it. Supporting resource load statistics is interesting for us anyway; we get feature requests for this all the time.
Comment 8 Charlie Turner 2017-07-11 08:58:03 PDT
Created attachment 315114 [details]
Patch
Comment 9 WebKit Commit Bot 2017-07-11 11:10:18 PDT
Comment on attachment 315114 [details]
Patch

Clearing flags on attachment: 315114

Committed r219345: <http://trac.webkit.org/changeset/219345>
Comment 10 WebKit Commit Bot 2017-07-11 11:10:19 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Carlos Alberto Lopez Perez 2017-07-11 11:12:22 PDT
Reopening: r219345 was a gardening commit
Comment 12 Carlos Garcia Campos 2017-10-03 10:08:24 PDT
Created attachment 322538 [details]
Patch
Comment 13 Build Bot 2017-10-03 10:09:33 PDT
Attachment 322538 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:53:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:55:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:57:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:76:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:122:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:147:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:169:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:343:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 9 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 Chris Dumez 2017-10-03 13:20:06 PDT
Comment on attachment 322538 [details]
Patch

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

> Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:51
> +    void setStatisticsLastSeen(const String&, double);

Since there are a lot of these and they are only used for testing, I had intentionally not added them to APIWebSiteDataStore.h. Instead, I had the API side (see existing ObjC API such as _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours) get the resource load statistics from the WebSiteDataStore and use the statistics object directly.

> Tools/WebKitTestRunner/TestController.cpp:-2295
> -#if !PLATFORM(COCOA) || !WK_API_ENABLED

I believe this change breaks the mac-32bit EWS.
Comment 15 Build Bot 2017-10-03 14:08:40 PDT
Comment on attachment 322538 [details]
Patch

Attachment 322538 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4744706

New failing tests:
workers/wasm-hashset.html
Comment 16 Build Bot 2017-10-03 14:08:42 PDT
Created attachment 322577 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 17 Carlos Garcia Campos 2017-10-04 00:06:00 PDT
(In reply to Chris Dumez from comment #14)
> Comment on attachment 322538 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=322538&action=review
> 
> > Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:51
> > +    void setStatisticsLastSeen(const String&, double);
> 
> Since there are a lot of these and they are only used for testing, I had
> intentionally not added them to APIWebSiteDataStore.h. Instead, I had the
> API side (see existing ObjC API such as
> _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours)
> get the resource load statistics from the WebSiteDataStore and use the
> statistics object directly.

I know, but we don't have other C API to do the same, so I don't know how to implement the test controller methods without adding C API.

> > Tools/WebKitTestRunner/TestController.cpp:-2295
> > -#if !PLATFORM(COCOA) || !WK_API_ENABLED
> 
> I believe this change breaks the mac-32bit EWS.

Right, I guess I need to ifdef the implementation of every method now, I'll try.
Comment 18 Carlos Garcia Campos 2017-10-04 00:43:46 PDT
(In reply to Carlos Garcia Campos from comment #17)
> > > Tools/WebKitTestRunner/TestController.cpp:-2295
> > > -#if !PLATFORM(COCOA) || !WK_API_ENABLED
> > 
> > I believe this change breaks the mac-32bit EWS.
> 
> Right, I guess I need to ifdef the implementation of every method now, I'll
> try.

I can leave it as it was since we don't define WK_API_ENABLED
Comment 19 Carlos Garcia Campos 2017-10-04 00:44:55 PDT
Created attachment 322637 [details]
Fix the build
Comment 20 Build Bot 2017-10-04 00:46:21 PDT
Attachment 322637 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:53:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:55:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:57:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:76:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:122:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:147:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:169:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp:343:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 9 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 21 Michael Catanzaro 2017-10-04 03:46:14 PDT
(In reply to Carlos Garcia Campos from comment #17)
> I know, but we don't have other C API to do the same, so I don't know how to
> implement the test controller methods without adding C API.

I'm pretty sure we do not want to start using GLib API from the test controller...?
Comment 22 Carlos Garcia Campos 2017-10-04 03:48:36 PDT
(In reply to Michael Catanzaro from comment #21)
> (In reply to Carlos Garcia Campos from comment #17)
> > I know, but we don't have other C API to do the same, so I don't know how to
> > implement the test controller methods without adding C API.
> 
> I'm pretty sure we do not want to start using GLib API from the test
> controller...?

We can't. There's no easy way to add private api to the glib API just for WTR.
Comment 23 Chris Dumez 2017-10-04 09:06:28 PDT
(In reply to Carlos Garcia Campos from comment #17)
> (In reply to Chris Dumez from comment #14)
> > Comment on attachment 322538 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=322538&action=review
> > 
> > > Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:51
> > > +    void setStatisticsLastSeen(const String&, double);
> > 
> > Since there are a lot of these and they are only used for testing, I had
> > intentionally not added them to APIWebSiteDataStore.h. Instead, I had the
> > API side (see existing ObjC API such as
> > _resourceLoadStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours)
> > get the resource load statistics from the WebSiteDataStore and use the
> > statistics object directly.
> 
> I know, but we don't have other C API to do the same, so I don't know how to
> implement the test controller methods without adding C API.

You misunderstood my comment I believe. I am fine with you adding C API. I just want this C API to use the ResourceLoadStatisticsStore directly (like we do in the ObjC API) instead of adding ALL those methods on APIWebsiteDataStore.
Comment 24 Chris Dumez 2017-10-04 09:08:15 PDT
Comment on attachment 322637 [details]
Fix the build

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

Please apply previous review comments.

> Source/WebKit/UIProcess/API/APIWebsiteDataStore.h:51
> +    void setStatisticsLastSeen(const String&, double);

We do not need all those methods.

> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:61
> +    WebKit::toImpl(dataStoreRef)->setStatisticsLastSeen(WebKit::toImpl(host)->string(), seconds);

auto& statistics = WebKit::toImpl(dataStoreRef)->resourceLoadStatistics();
statistics.setStatisticsLastSeen(WebKit::toImpl(host)->string(), seconds);
Comment 25 Carlos Garcia Campos 2017-10-05 01:47:08 PDT
Created attachment 322806 [details]
Patch
Comment 26 Chris Dumez 2017-10-05 09:02:58 PDT
Comment on attachment 322806 [details]
Patch

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

r=me with review comments.

> Source/WebCore/platform/glib/FileMonitorGLib.cpp:38
> +    if (path.isEmpty() || !modificationHandler)

This is a bad check. !modificationHandler will always be true since you WTFMove() it above..

I think this show this is not tested. This is supposed to be covered by Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp API test which is probably not enabled for GTK port?

> Source/WebCore/platform/glib/FileMonitorGLib.cpp:41
> +    GRefPtr<GFile> file = adoptGRef(g_file_new_for_path(fileSystemRepresentation(path).data()));

auto file ?

> Source/WebCore/platform/glib/FileMonitorGLib.cpp:60
> +    if (event == G_FILE_MONITOR_EVENT_DELETED)

We may not want to call the callback if event == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED ?

> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h:44
> +typedef void (*WKWebsiteDataStoreIsStatisticsPrevalentResourceFunction)(bool isPrevalentResource, WKErrorRef error, void* functionContext);

Do we ever use those WKErrorRef parameters? If not, I would suggest dropping them.

> Tools/WebKitTestRunner/TestController.cpp:2312
> +struct ResourceStatisticsCallbackContext {

I would give this a constructor that takes a TestController& in parameter and initializes both done / result to false.
ResourceStatisticsCallbackContext(TestController& testController)
    : testController(&testController)
{ }

otherwise, the call sites are not very readable.

> Tools/WebKitTestRunner/TestController.cpp:2314
> +    bool done;

bool done { false };

> Tools/WebKitTestRunner/TestController.cpp:2315
> +    bool result;

bool result { false };

> Tools/WebKitTestRunner/TestController.cpp:2329
> +    ResourceStatisticsCallbackContext context = { this, false, false };

ResourceStatisticsCallbackContext context(*this);

> Tools/WebKitTestRunner/TestController.cpp:2345
> +    ResourceStatisticsCallbackContext context = { this, false, false };

ResourceStatisticsCallbackContext context(*this);

> Tools/WebKitTestRunner/TestController.cpp:2361
> +    ResourceStatisticsCallbackContext context = { this, false, false };

ResourceStatisticsCallbackContext context(*this);
Comment 27 Carlos Garcia Campos 2017-10-05 09:08:03 PDT
Comment on attachment 322806 [details]
Patch

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

>> Source/WebCore/platform/glib/FileMonitorGLib.cpp:38
>> +    if (path.isEmpty() || !modificationHandler)
> 
> This is a bad check. !modificationHandler will always be true since you WTFMove() it above..
> 
> I think this show this is not tested. This is supposed to be covered by Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp API test which is probably not enabled for GTK port?

Oops good catch! :-P I'll enable the test too.

>> Source/WebCore/platform/glib/FileMonitorGLib.cpp:60
>> +    if (event == G_FILE_MONITOR_EVENT_DELETED)
> 
> We may not want to call the callback if event == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED ?

I was not sure, attribute change is a modification in the end.
Comment 28 Michael Catanzaro 2017-10-05 09:08:22 PDT
(In reply to Chris Dumez from comment #26)
> I would give this a constructor that takes a TestController& in parameter
> and initializes both done / result to false.
> ResourceStatisticsCallbackContext(TestController& testController)
>     : testController(&testController)
> { }

explicit
Comment 29 Chris Dumez 2017-10-05 09:16:24 PDT
(In reply to Michael Catanzaro from comment #28)
> (In reply to Chris Dumez from comment #26)
> > I would give this a constructor that takes a TestController& in parameter
> > and initializes both done / result to false.
> > ResourceStatisticsCallbackContext(TestController& testController)
> >     : testController(&testController)
> > { }
> 
> explicit

+1 :)
Comment 30 Chris Dumez 2017-10-05 09:16:52 PDT
(In reply to Carlos Garcia Campos from comment #27)
> Comment on attachment 322806 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=322806&action=review
> 
> >> Source/WebCore/platform/glib/FileMonitorGLib.cpp:38
> >> +    if (path.isEmpty() || !modificationHandler)
> > 
> > This is a bad check. !modificationHandler will always be true since you WTFMove() it above..
> > 
> > I think this show this is not tested. This is supposed to be covered by Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp API test which is probably not enabled for GTK port?
> 
> Oops good catch! :-P I'll enable the test too.
> 
> >> Source/WebCore/platform/glib/FileMonitorGLib.cpp:60
> >> +    if (event == G_FILE_MONITOR_EVENT_DELETED)
> > 
> > We may not want to call the callback if event == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED ?
> 
> I was not sure, attribute change is a modification in the end.

Fair enough.
Comment 31 Carlos Garcia Campos 2017-10-05 10:39:39 PDT
Created attachment 322852 [details]
Patch for landing

I've addressed all review comments, added the FileMonitor test and fixed the impl to pass the test :-) Thanks Chris!
Comment 32 Carlos Garcia Campos 2017-10-05 10:41:36 PDT
Created attachment 322853 [details]
Patch for landing

Read the explicit comment after submitting the patch, added too.
Comment 33 Carlos Garcia Campos 2017-10-05 23:48:54 PDT
Committed r222962: <http://trac.webkit.org/changeset/222962>
Comment 34 Radar WebKit Bug Importer 2017-10-05 23:49:36 PDT
<rdar://problem/34851362>