Bug 195969

Summary: [ Mac WK2 ] Layout Test js/dom/unhandled-promise-rejection-bindings-type-error.html is a flaky failure
Product: WebKit Reporter: Shawn Roberts <sroberts>
Component: Tools / TestsAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, hi, joepeck, lforschler, saam, webkit-bot-watchers-bugzilla, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Shawn Roberts 2019-03-19 15:50:56 PDT
The following layout test is failing on Mac WK2

js/dom/unhandled-promise-rejection-bindings-type-error.html

Probable cause:

Just showed up on the dashboard for the first time around r243141. Cannot find a regression point as I got it to fail locally with the oldest builds I could spade of Mojave Release WK2(228049) and Mojave Debug WK2(230024) . 
I could get it to fail consistently once I added -gf to my repro steps, and it would fail usually 2 within 10 tries. I could also get it to fail when running without it, but maybe 1 or 2 times in 10000 iterations. I get the same diff locally as seen on the server error. 

Reproduced with :

run-webkit-tests js/dom/unhandled-promise-rejection-bindings-type-error.html -gf --iterations 2500 --exit-after-n-failures=2 --no-retry
run-webkit-tests js/dom/unhandled-promise-rejection-bindings-type-error.html -gf --iterations 2500 --debug --exit-after-n-failures=2 --no-retry

Flakiness Dashboard:

https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=js%2Fdom%2Funhandled-promise-rejection-bindings-type-error.html

Diff:

--- /Volumes/Data/slave/mojave-debug-tests-wk2/build/layout-test-results/js/dom/unhandled-promise-rejection-bindings-type-error-expected.txt
+++ /Volumes/Data/slave/mojave-debug-tests-wk2/build/layout-test-results/js/dom/unhandled-promise-rejection-bindings-type-error-actual.txt
@@ -1,10 +1,7 @@
-CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: The PromiseRejectionEvent.promise getter can only be used on instances of PromiseRejectionEvent
 Test rejected promises are returned from bindings and trigger unhandledrejection.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-PASS error.promise is promise
-PASS error.reason instanceof TypeError is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
Comment 1 Radar WebKit Bug Importer 2019-03-19 15:52:03 PDT
<rdar://problem/49039441>
Comment 2 Joseph Pecoraro 2019-03-19 17:46:14 PDT
It is possible for this to fail if somehow the 100ms timeout fires before promise rejections are handled. Which in practice should never happen...

    --debug will certainly make things slower
    -g is libgmalloc which will make the tests slower still
    -f is fully parallel which shouldn't do much

Perhaps there is something better for the test to use instead of setTimeout.

Maybe queueMicrotask a few times?
Comment 3 Devin Rousso 2019-05-13 01:04:14 PDT
Created attachment 369707 [details]
Patch
Comment 4 WebKit Commit Bot 2019-05-13 15:07:58 PDT
Comment on attachment 369707 [details]
Patch

Clearing flags on attachment: 369707

Committed r245256: <https://trac.webkit.org/changeset/245256>
Comment 5 WebKit Commit Bot 2019-05-13 15:07:59 PDT
All reviewed patches have been landed.  Closing bug.