Bug 157816

Summary: REGRESSION (r200887): LayoutTest http/tests/performance/performance-resource-timing-cached-entries.html is flaky
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, buildbot, commit-queue, rniwa, yoav
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=157669
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews103 for mac-yosemite none

Description Ryan Haddad 2016-05-17 15:30:36 PDT
LayoutTest http/tests/performance/performance-resource-timing-cached-entries.html is flaky on all platforms

Most recent failure:
<https://build.webkit.org/results/Apple%20El%20Capitan%20Debug%20WK1%20(Tests)/r201023%20(5296)/results.html>

Flakiness dashboard:
<https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=http%2Ftests%2Fperformance%2Fperformance-resource-timing-cached-entries.html>

--- /Volumes/Data/slave/elcapitan-debug-tests-wk1/build/layout-test-results/http/tests/performance/performance-resource-timing-cached-entries-expected.txt
+++ /Volumes/Data/slave/elcapitan-debug-tests-wk1/build/layout-test-results/http/tests/performance/performance-resource-timing-cached-entries-actual.txt
@@ -1,2 +1,2 @@
-PASS foundResource is 2
+FAIL foundResource should be 2. Was 3.
Comment 1 Alexey Proskuryakov 2016-05-17 22:32:55 PDT
This test is super flaky, even causing EWS false positives. It needs to be dealt with very soon.

Should we just roll out the patch, given that its test doesn't work reliably?
Comment 2 Yoav Weiss 2016-05-17 22:54:35 PDT
I'm looking into it now.
Comment 3 Yoav Weiss 2016-05-17 23:10:19 PDT
Created attachment 279216 [details]
Patch
Comment 4 Yoav Weiss 2016-05-17 23:12:34 PDT
I wasn't able to recreate the issue locally, but since the test showed more entries than expected, clearing the entries at the beginning of the test might do the trick.
I'll open a separate issue to investigate why this is required in some cases. (as it should happen automatically between navigations)
Comment 5 WebKit Commit Bot 2016-05-17 23:12:43 PDT
Attachment 279216 [details] did not pass style-queue:


ERROR: LayoutTests/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 6 Yoav Weiss 2016-05-17 23:45:33 PDT
Created attachment 279221 [details]
Patch
Comment 7 Yoav Weiss 2016-05-17 23:46:26 PDT
(In reply to comment #6)
> Created attachment 279221 [details]
> Patch

While removing my own tabs from the ChangeLog (oops), I found several others, so removed them as well.
Comment 8 Alexey Proskuryakov 2016-05-18 09:38:47 PDT
Comment on attachment 279221 [details]
Patch

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

> LayoutTests/ChangeLog:8
> +        This patch attempts to unflake the test.

What is your plan for investigating the root cause? With the test deflaked on the bots, and with the issue not reproducible for you locally, I don't see how it can be actionable.
Comment 9 Yoav Weiss 2016-05-18 14:00:22 PDT
I'm not sure, but I thought unflaking the test would help avoid EWS false positives. We could always later on introduce an ignored test that just checks for this flakiness on the bots.

Regarding the issue itself, the entries are stored inside m_performance which is referenced by DOMWindow. Is it possible that DOMWindow survives navigations/test runs?

If so, the solution is most probably to clear m_performance when a new navigation is initiated. Does that make sense?
Comment 10 Alexey Proskuryakov 2016-05-18 14:05:36 PDT
> Is it possible that DOMWindow survives navigations/test runs?

That seems unlikely.

Is there any logging you can add to the test to see what happened (maybe print out all the resources if the count is wrong)? You can mark the test as flaky and add the extra logging - that way you can collect information and still unbreak EWS.
Comment 11 Yoav Weiss 2016-05-18 14:08:24 PDT
(In reply to comment #10)
> > Is it possible that DOMWindow survives navigations/test runs?
> 
> That seems unlikely.
> 
> Is there any logging you can add to the test to see what happened (maybe
> print out all the resources if the count is wrong)? You can mark the test as
> flaky and add the extra logging - that way you can collect information and
> still unbreak EWS.

That makes sense. I'll do that shortly.
Comment 12 Yoav Weiss 2016-05-18 14:49:33 PDT
Created attachment 279286 [details]
Patch
Comment 13 Alexey Proskuryakov 2016-05-18 15:56:56 PDT
Comment on attachment 279286 [details]
Patch

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

> LayoutTests/http/tests/performance/performance-resource-timing-cached-entries.html:11
> +    if (window.performance)
> +        console.log("current entries: " + performance.getEntriesByType('resource').length);

I was thinking of something like (right after a shouldBe()):

if (foundResource !== 2) {
    for (var i = 0; i < resources.length; ++i) {
        if (resources[i].name.indexOf("square") !== -1)
            debug(resources.name);
    }
}

That way, there will be more information logged, and you won't need to change the expectation.
Comment 14 Yoav Weiss 2016-05-18 22:59:30 PDT
Created attachment 279355 [details]
Patch
Comment 15 Yoav Weiss 2016-05-18 23:11:28 PDT
Created attachment 279357 [details]
Patch
Comment 16 Yoav Weiss 2016-05-18 23:12:38 PDT
Comment on attachment 279357 [details]
Patch

Added more logs. Landing
Comment 17 Build Bot 2016-05-18 23:40:49 PDT
Comment on attachment 279357 [details]
Patch

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

New failing tests:
storage/websql/database-lock-after-reload.html
Comment 18 Build Bot 2016-05-18 23:40:56 PDT
Created attachment 279360 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 19 Yoav Weiss 2016-05-19 00:46:21 PDT
Comment on attachment 279357 [details]
Patch

The failing tests seem unrelated. Trying again to cq+
Comment 20 WebKit Commit Bot 2016-05-19 01:07:30 PDT
Comment on attachment 279357 [details]
Patch

Clearing flags on attachment: 279357

Committed r201130: <http://trac.webkit.org/changeset/201130>
Comment 21 WebKit Commit Bot 2016-05-19 01:07:35 PDT
All reviewed patches have been landed.  Closing bug.