Bug 148320 - Layout Test streams/reference-implementation/readable-stream.html is flaky
Summary: Layout Test streams/reference-implementation/readable-stream.html is flaky
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Xabier Rodríguez Calvar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-21 12:17 PDT by Tim Horton
Modified: 2015-08-28 03:03 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.11 KB, patch)
2015-08-24 09:21 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch (4.41 KB, patch)
2015-08-24 16:30 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch for landing (3.91 KB, patch)
2015-08-28 01:55 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2015-08-21 12:17:29 PDT
The following layout test recently started flaking on Mac:

streams/reference-implementation/readable-stream.html

See:

https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=streams%2Freference-implementation%2Freadable-stream.html
Comment 1 Tim Horton 2015-08-21 12:17:55 PDT
Youenn, this looks like a feature you've been working on. Any ideas why this might have recently started flaking?
Comment 2 youenn fablet 2015-08-21 12:41:45 PDT
Tim, thanks for spotting these flakiness.
Calvaris, it seems the changes brought on the tests when inverting the order of the promise resolution have some bad effects. Will you have some time to check these?
Comment 3 Xabier Rodríguez Calvar 2015-08-24 01:09:47 PDT
(In reply to comment #2)
> Tim, thanks for spotting these flakiness.
> Calvaris, it seems the changes brought on the tests when inverting the order
> of the promise resolution have some bad effects. Will you have some time to
> check these?

Sure, I'm on it now.
Comment 4 Xabier Rodríguez Calvar 2015-08-24 09:21:24 PDT
Created attachment 259755 [details]
Patch

It is true that timeout hitting earlier happens a bit more often after the promise changes but it was already happening before aparently. Let's try to increase the timeout and see if the problem disappears.
Comment 5 youenn fablet 2015-08-24 11:05:42 PDT
(In reply to comment #4)
> Created attachment 259755 [details]
> Patch
> 
> It is true that timeout hitting earlier happens a bit more often after the
> promise changes but it was already happening before aparently. Let's try to
> increase the timeout and see if the problem disappears.

Then, maybe we could rewrite the test cases a bit to reduce the flakiness  probability.
In particular we could call setTimeout at the latest time.

For instance, in test 6, we could move the call to setTimeout within startPromise.then() callback.
Comment 6 Xabier Rodríguez Calvar 2015-08-24 16:30:11 PDT
Created attachment 259791 [details]
Patch

Set timeouts later as suggested by Youenn. I thought of that too but I was reluctant because we'd lose the structure of the original reference test, but I decided to add a comment to help with that.
Comment 7 Xabier Rodríguez Calvar 2015-08-27 09:52:44 PDT
This flakiness seemed important. Can we get this reviewed?
Comment 8 Alexey Proskuryakov 2015-08-27 10:30:20 PDT
Comment on attachment 259791 [details]
Patch

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

Sad, but looks like there is no other way to test for this.

> LayoutTests/streams/reference-implementation/readable-stream.html:273
> +        // In the original test this timeout is outside the promise fulfillment callback, but it makes test flakier so
> +        // we better move it inside here.

This comment is not helpful without a reference to original. Are we modifying a W3C test here?

I would just remove the comment (and other copies of it) unless there is a really important reason for it - otherwise anyone interested can just blame the source to see history.
Comment 9 youenn fablet 2015-08-27 13:44:15 PDT
If feasible, one option might be to backport these changes to the reference tests.
Comment 10 Xabier Rodríguez Calvar 2015-08-28 01:55:03 PDT
Created attachment 260141 [details]
Patch for landing
Comment 11 Xabier Rodríguez Calvar 2015-08-28 01:55:53 PDT
(In reply to comment #9)
> If feasible, one option might be to backport these changes to the reference
> tests.

I'll propose the change, let's see if Domenic accepts it.
Comment 12 WebKit Commit Bot 2015-08-28 02:48:59 PDT
Comment on attachment 260141 [details]
Patch for landing

Clearing flags on attachment: 260141

Committed r189093: <http://trac.webkit.org/changeset/189093>
Comment 13 WebKit Commit Bot 2015-08-28 02:49:02 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Xabier Rodríguez Calvar 2015-08-28 03:03:07 PDT
(In reply to comment #11)
> (In reply to comment #9)
> > If feasible, one option might be to backport these changes to the reference
> > tests.
> 
> I'll propose the change, let's see if Domenic accepts it.

Done:

https://github.com/whatwg/streams/pull/392