Bug 158902 - js/dom/global-constructors-attributes.html is flaky: ResourceTiming runtime feature leaks between tests
Summary: js/dom/global-constructors-attributes.html is flaky: ResourceTiming runtime f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-17 22:50 PDT by Alexey Proskuryakov
Modified: 2016-08-19 14:00 PDT (History)
16 users (show)

See Also:


Attachments
Patch (1.46 KB, patch)
2016-06-18 00:21 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (1.46 KB, patch)
2016-06-18 00:54 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (6.19 KB, patch)
2016-06-30 07:05 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.09 MB, application/zip)
2016-06-30 07:37 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-wk2 (621.81 KB, application/zip)
2016-06-30 08:12 PDT, Build Bot
no flags Details
Patch (9.72 KB, patch)
2016-07-06 07:05 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (1.07 MB, application/zip)
2016-07-06 08:16 PDT, Build Bot
no flags Details
Patch (10.15 KB, patch)
2016-07-06 09:58 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-yosemite (878.22 KB, application/zip)
2016-07-06 10:45 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-yosemite-wk2 (882.70 KB, application/zip)
2016-07-06 10:49 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-yosemite (1.50 MB, application/zip)
2016-07-06 11:00 PDT, Build Bot
no flags Details
Patch (9.79 KB, patch)
2016-07-06 11:57 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (6.23 KB, patch)
2016-07-06 13:53 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (11.45 KB, patch)
2016-07-08 05:54 PDT, Yoav Weiss
no flags Details | Formatted Diff | Diff
Patch (6.23 KB, patch)
2016-07-11 01:06 PDT, Yoav Weiss
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 2016-06-17 22:50:18 PDT
In my local test run, js/dom/global-constructors-attributes.html failed because PerformanceEntry and PerformanceResourceTiming were unexpectedly enabled.

Looks like nothing resets runtime enabled properties after they are enabled via Internals. This should be done in Internals::resetToConsistentState().
Comment 1 Yoav Weiss 2016-06-17 22:53:02 PDT
Thanks for reporting. I'll work on a patch and hope to upload it shortly
Comment 2 Yoav Weiss 2016-06-18 00:21:08 PDT
Created attachment 281609 [details]
Patch
Comment 3 WebKit Commit Bot 2016-06-18 00:22:38 PDT
Attachment 281609 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Yoav Weiss 2016-06-18 00:54:43 PDT
Created attachment 281611 [details]
Patch
Comment 5 Alex Christensen 2016-06-18 21:51:33 PDT
Do we not have this problem with other runtime enabled features?
Comment 6 Alexey Proskuryakov 2016-06-18 23:15:18 PDT
Comment on attachment 281611 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        Make sure that the ResourceTiming runtime flag is turned off between tests.

As Alex noted, this presumably happens with other runtime enabled features too.

> Source/WebCore/testing/Internals.cpp:418
> +    RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(false);

My thinking was that we need to record original values before changing them. A hardcoded false could get out of sync with a changed default.
Comment 7 Alexey Proskuryakov 2016-06-21 12:01:38 PDT
Yoav, do you expect to have a fix soon?
Comment 8 Yoav Weiss 2016-06-22 14:14:59 PDT
Apologies. I'm currently at a conference, so it'll probably be a few days before I can work on this.

To make sure that I understand the proposed solution, do you think I should add a method to RuntimeEnabledFeatures that resets all the flags to their initial state?
Comment 9 Alexey Proskuryakov 2016-06-22 14:27:27 PDT
Yes, and one thing that is important is to actually use initial state without hardcoding it again - we shouldn't have a second copy of initial state values for every feature here.
Comment 10 Yoav Weiss 2016-06-30 07:05:46 PDT
Created attachment 282437 [details]
Patch
Comment 11 Yoav Weiss 2016-06-30 07:09:58 PDT
Added a reset() func as discussed and called it from internals.

PTAL?
Comment 12 Build Bot 2016-06-30 07:37:35 PDT
Comment on attachment 282437 [details]
Patch

Attachment 282437 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1600630

Number of test failures exceeded the failure limit.
Comment 13 Build Bot 2016-06-30 07:37:41 PDT
Created attachment 282440 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 14 Build Bot 2016-06-30 08:12:47 PDT
Comment on attachment 282437 [details]
Patch

Attachment 282437 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1600727

Number of test failures exceeded the failure limit.
Comment 15 Build Bot 2016-06-30 08:12:52 PDT
Created attachment 282443 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 16 Alex Christensen 2016-06-30 10:58:21 PDT
Comment on attachment 282437 [details]
Patch

Not this initial state.  This makes all the tests fail.  The initial state that DumpRenderTree and WebKitTestRunner set.
Comment 17 Yoav Weiss 2016-07-01 02:20:15 PDT
(In reply to comment #16)
> Comment on attachment 282437 [details]
> Patch
> 
> Not this initial state.  This makes all the tests fail.  The initial state
> that DumpRenderTree and WebKitTestRunner set.

I'm not familiar with that state and where it is set. Could you point me in the right direction?
Comment 18 Alex Christensen 2016-07-05 12:28:16 PDT
resetWebPreferencesToConsistentValues in Mac and Win DumpRenderTree
InjectedBundle::beginTesting in WebKitTestRunner
Comment 19 Yoav Weiss 2016-07-06 07:05:31 PDT
Created attachment 282891 [details]
Patch
Comment 20 Build Bot 2016-07-06 08:16:53 PDT
Comment on attachment 282891 [details]
Patch

Attachment 282891 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1635972

Number of test failures exceeded the failure limit.
Comment 21 Build Bot 2016-07-06 08:16:58 PDT
Created attachment 282897 [details]
Archive of layout-test-results from ews106 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 22 Yoav Weiss 2016-07-06 09:58:35 PDT
Created attachment 282905 [details]
Patch
Comment 23 Yoav Weiss 2016-07-06 10:16:25 PDT
Current patch changes the defaults for some of the runtime enabled features, as that seems to be the cause for the test failures, but that's obviously not the right solution. I'm just testing it to see if this is the only reason for the bot failures.
Comment 24 Build Bot 2016-07-06 10:45:51 PDT
Comment on attachment 282905 [details]
Patch

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

New failing tests:
platform/mac/fast/text/trailing-word-parse.html
fast/text/trailing-word.html
js/dom/global-constructors-attributes.html
Comment 25 Build Bot 2016-07-06 10:45:56 PDT
Created attachment 282907 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 26 Build Bot 2016-07-06 10:49:19 PDT
Comment on attachment 282905 [details]
Patch

Attachment 282905 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1636565

New failing tests:
platform/mac/fast/text/trailing-word-parse.html
fast/dom/navigator-detached-no-crash.html
fast/text/trailing-word.html
js/dom/global-constructors-attributes.html
Comment 27 Build Bot 2016-07-06 10:49:24 PDT
Created attachment 282908 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 28 Build Bot 2016-07-06 11:00:17 PDT
Comment on attachment 282905 [details]
Patch

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

New failing tests:
platform/mac/fast/text/trailing-word-parse.html
fast/text/trailing-word.html
js/dom/global-constructors-attributes.html
Comment 29 Build Bot 2016-07-06 11:00:22 PDT
Created attachment 282910 [details]
Archive of layout-test-results from ews113 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 30 Yoav Weiss 2016-07-06 11:57:44 PDT
Created attachment 282918 [details]
Patch
Comment 31 Yoav Weiss 2016-07-06 12:12:13 PDT
Seems like IndexedDB gets enabled to true in the mac port (as well as the WebView), so I had to turn it to true in order for the related tests to pass.

I wonder what's the best course of action here. Reseting it to false breaks the tests, and at the same time, AFAICT setting it to true will change its state in other ports (including iossim)
Comment 32 Yoav Weiss 2016-07-06 13:53:13 PDT
Created attachment 282941 [details]
Patch
Comment 33 Benjamin Poulain 2016-07-06 22:06:10 PDT
Comment on attachment 282941 [details]
Patch

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

Check this before landing:

> Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:67
> -    , m_isIndexedDBEnabled(false)
> +    m_isIndexedDBEnabled = true;

You are changing this default. Is is intended?
Comment 34 Yoav Weiss 2016-07-06 22:51:22 PDT
(In reply to comment #33)
> Comment on attachment 282941 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=282941&action=review
> 
> Check this before landing:
> 
> > Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:67
> > -    , m_isIndexedDBEnabled(false)
> > +    m_isIndexedDBEnabled = true;
> 
> You are changing this default. Is is intended?

It is intended, but I'm not 100% sure this is the right thing to do. See https://bugs.webkit.org/show_bug.cgi?id=158902#c31

The default gets overridden to true in the mac and win WebViews as well as the WK2 port, and there are various tests that rely on it. But, other ports don't necessarily turn it on, so changing the default would change their behavior. So, I'm not sure what's the best course of action here
Comment 35 Alexey Proskuryakov 2016-07-07 10:02:52 PDT
Would it be feasible to record the original value of the setting when it's overridden using RuntimeEnabledFeatures?
Comment 36 Yoav Weiss 2016-07-07 12:35:52 PDT
(In reply to comment #35)
> Would it be feasible to record the original value of the setting when it's
> overridden using RuntimeEnabledFeatures?

The current flow, unless I change the default value for IndexedDB, is:
* RuntimeEnabledFeatures initializes IndexedDB to false
* WebView/WebKit2 overrides that to true when initialized
* If we reset back to defaults between tests, we override the overrides and bring it back to false.

Do you propose that we'd create a special "set and keep it set across resets" setter for the various flags in RuntimeEnabledFeatures?
Comment 37 Alexey Proskuryakov 2016-07-07 13:50:10 PDT
My idea is that the first time a RuntimeEnabledFeature setter is called, we call WebCore to get the current state of it, remember that, and always reset back to that state between tests.

There are a few essentially equivalent variations here. For example, we could get and remember WebCore's idea of feature state for all RuntimeEnabledFeatures at once the first time one of the setters is called.
Comment 38 Yoav Weiss 2016-07-08 05:54:28 PDT
Created attachment 283141 [details]
Patch
Comment 39 Yoav Weiss 2016-07-08 06:00:19 PDT
I've changed the approach to:
* Freeze the current feature set after it's changed in WebProcess/WebView.
* Restore the features to that frozen set between tests.

It seems to be working and doesn't contain IndexedDB specific logic. It's a pretty radical change from the previous approach, so I think a new review is required.

ap and or benjamin - PTAL?
Comment 40 Benjamin Poulain 2016-07-08 14:54:00 PDT
(In reply to comment #34)
> (In reply to comment #33)
> > Comment on attachment 282941 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=282941&action=review
> > 
> > Check this before landing:
> > 
> > > Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp:67
> > > -    , m_isIndexedDBEnabled(false)
> > > +    m_isIndexedDBEnabled = true;
> > 
> > You are changing this default. Is is intended?
> 
> It is intended, but I'm not 100% sure this is the right thing to do. See
> https://bugs.webkit.org/show_bug.cgi?id=158902#c31
> 
> The default gets overridden to true in the mac and win WebViews as well as
> the WK2 port, and there are various tests that rely on it. But, other ports
> don't necessarily turn it on, so changing the default would change their
> behavior. So, I'm not sure what's the best course of action here

I prefer your previous approach. My previous r+ still holds.

For testing, we should have a common environment for all ports. If Mac and Win already enabled it by default, it sounds like the right thing to do is to enable it everywhere.
IndexedDB is an important feature anyway. It is beneficial for GTK and EFL to support it ASAP.

I would prefer if you land the previous patch with common features and a reset(). If that breaks the universe, we roll back and discuss what to do about GTK/EFL.
Comment 41 Yoav Weiss 2016-07-11 01:06:06 PDT
Created attachment 283305 [details]
Patch
Comment 42 Yoav Weiss 2016-07-11 01:07:16 PDT
Brought back previous approach. I'll land it this PST afternoon if no objections arise.
Comment 43 Benjamin Poulain 2016-07-11 01:19:44 PDT
Comment on attachment 283305 [details]
Patch

Go for it. Thanks Yoav.
Comment 44 WebKit Commit Bot 2016-07-12 02:05:35 PDT
Comment on attachment 283305 [details]
Patch

Clearing flags on attachment: 283305

Committed r203110: <http://trac.webkit.org/changeset/203110>
Comment 45 WebKit Commit Bot 2016-07-12 02:05:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 46 Brady Eidson 2016-08-19 14:00:08 PDT
This change makes it impossible to set features that are enabled by the WK2 web process init parameters. WebPage.cpp primes the RuntimeEnabledFeatures, but then upon creation of the Internals object they are reset to initial values.