Bug 170177

Summary: LayoutTest fast/images/reset-image-animation.html is a flaky failure
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: Fujii Hironori <Hironori.Fujii>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, Hironori.Fujii, jonlee, sabouhallawa, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Ryan Haddad 2017-03-28 08:59:00 PDT
LayoutTest fast/images/reset-image-animation.html is a flaky failure

https://build.webkit.org/results/Apple%20Sierra%20Debug%20WK2%20(Tests)/r214472%20(169)/results.html

https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=fast%2Fimages%2Freset-image-animation.html

--- /Volumes/Data/slave/sierra-debug-tests-wk2/build/layout-test-results/fast/images/reset-image-animation-expected.txt
+++ /Volumes/Data/slave/sierra-debug-tests-wk2/build/layout-test-results/fast/images/reset-image-animation-actual.txt
@@ -4,7 +4,7 @@
 
 
 PASS internals.imageFrameIndex(image) is 0
-PASS internals.imageFrameIndex(image) is 1
+FAIL internals.imageFrameIndex(image) should be 1. Was 0.
 The animation of the image was reset.
 PASS internals.imageFrameIndex(image) is 0
 PASS internals.imageFrameIndex(image) is 1
Comment 1 Alexey Proskuryakov 2017-03-29 09:52:27 PDT
No clear regression point, but this has become much more frequent about a week ago.
Comment 2 Alexey Proskuryakov 2017-03-29 13:20:28 PDT
Easily reproducible under CPU pressure:

run-webkit-tests -1 -v --no-build fast/images/reset-image-animation.html --repeat-each 1000 -f --child-processes=20
Comment 3 Alexey Proskuryakov 2017-03-29 17:35:26 PDT
r214450 had a fix to make the test not flaky, but it is still flaky.
Comment 4 Ryan Haddad 2017-04-04 18:00:27 PDT
Marked test as flaky in https://trac.webkit.org/r214921
Comment 5 Fujii Hironori 2023-04-26 17:46:50 PDT
WinCairo Debug is the most flaky bot.
https://results.webkit.org/?suite=layout-tests&test=fast%2Fimages%2Freset-image-animation.html

The decoding frame seems to be delayed under heavy CPU load.
The following patch makes the test stable.

diff --git a/LayoutTests/fast/images/reset-image-animation.html b/LayoutTests/fast/images/reset-image-animation.html
index 62cb9bf09894..634a79b7be04 100644
--- a/LayoutTests/fast/images/reset-image-animation.html
+++ b/LayoutTests/fast/images/reset-image-animation.html
@@ -16,7 +16,7 @@
                 shouldBe("internals.imageFrameIndex(image)", expectedFrame.toString());
                 setTimeout(() => {
                     resolve(expectedFrame + 1);
-                }, 30);
+                }, 300);
             });
         }
Comment 6 Fujii Hironori 2023-04-26 18:01:45 PDT
I tried another approach of retrying drawFrame until expected frame without extending the timer duration.
However, I'm observing timeout failure for this approach.
Decoding frame doesn't proceed.
I have to extend the timer duration in this approach too.

diff --git a/LayoutTests/fast/images/reset-image-animation.html b/LayoutTests/fast/images/reset-image-animation.html
index 62cb9bf09894..8c6fdc75ac14 100644
--- a/LayoutTests/fast/images/reset-image-animation.html
+++ b/LayoutTests/fast/images/reset-image-animation.html
@@ -13,6 +13,8 @@
                 let canvas = document.getElementById("canvas");
                 let context = canvas.getContext("2d");
                 context.drawImage(image, 0, 0, canvas.width, canvas.height);
+                if (internals.imageFrameIndex(image) != expectedFrame)
+                    return drawFrame(expectedFrame).then(resolve);
                 shouldBe("internals.imageFrameIndex(image)", expectedFrame.toString());
                 setTimeout(() => {
                     resolve(expectedFrame + 1);
Comment 7 Fujii Hironori 2023-04-26 18:13:44 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13219
Comment 8 EWS 2023-04-27 17:41:33 PDT
Committed 263478@main (b1cc64631025): <https://commits.webkit.org/263478@main>

Reviewed commits have been landed. Closing PR #13219 and removing active labels.
Comment 9 Radar WebKit Bug Importer 2023-04-27 17:42:19 PDT
<rdar://problem/108636160>