Bug 214673

Summary: [Win10] js/weakref-finalizationregistry.html is frequently timing out
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: Hironori.Fujii, keith_miller, webkit-bot-watchers-bugzilla, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   

Description Ryan Haddad 2020-07-22 21:12:41 PDT
js/weakref-finalizationregistry.html has been frequently timing out on Win10 bots since it was added with r264617.

--- /home/buildbot/worker/win10-release-tests/build/layout-test-results/js/weakref-finalizationregistry-expected.txt
+++ /home/buildbot/worker/win10-release-tests/build/layout-test-results/js/weakref-finalizationregistry-actual.txt
@@ -1,4 +1,6 @@
+FAIL: Timed out waiting for notifyDone to be called
 PASS successfullyParsed is true
 
 TEST COMPLETE
+Error
 

https://results.webkit.org/?suite=layout-tests&test=js%2Fweakref-finalizationregistry.html
Comment 1 Radar WebKit Bug Importer 2020-07-22 21:13:04 PDT
<rdar://problem/65971901>
Comment 2 Ryan Haddad 2020-07-22 21:15:51 PDT
Marked test as flaky in r264744
Comment 3 Keith Miller 2020-07-22 21:21:11 PDT
Man, gc tests are a real nightmare...
Comment 4 Fujii Hironori 2023-11-21 21:58:55 PST
WinCairo Debug and Release tester are constantly timing out. GTK Debug is ramdomly timing out.
https://results.webkit.org/?suite=layout-tests&test=js%2Fweakref-finalizationregistry.html
Comment 5 Fujii Hironori 2023-11-21 22:02:14 PST
It's flaky timeout for WinCairo Debug on my PC.
But, it will pass constantly by applying this patch.

diff --git a/LayoutTests/js/script-tests/weakref-finalizationregistry.js b/LayoutTests/js/script-tests/weakref-finalizationregistry.js
index 130c6c81d4de..be85642f01f0 100644
--- a/LayoutTests/js/script-tests/weakref-finalizationregistry.js
+++ b/LayoutTests/js/script-tests/weakref-finalizationregistry.js
@@ -18,7 +18,7 @@ function turnEventLoop() {
         setTimeout(() => {
             gc();
             resolve();
-        }, 1);
+        }, 30);
     });
 }
 
Does GC thread need a time to collect?
Comment 6 Fujii Hironori 2023-11-23 12:56:44 PST
The commit message of 248952@main explains why it wait for 1ms.

>    * js/script-tests/weakref-finalizationregistry.js:
>    (turnEventLoop): Use a timeout of 1ms instead of 0ms so that
>    the deferred work task that calls the JS FinalizationRegistry
>    callback gets a chance to run before we continue on to the
>    assertion that it was run.