Bug 221742

Summary: REGRESSION (r272414?): [macOS] TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo is a flaky failure
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: MediaAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cdumez, eric.carlson, jenner, jer.noble, peng.liu6, webkit-bot-watchers-bugzilla, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Ryan Haddad 2021-02-10 21:13:17 PST
The following test is a flaky failure on iOS and macOS bots:

 TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo
        LEAK: 1 WebProcessPool
        LEAK: 1 WebPageProxy
        
        /Volumes/Data/slave/bigsur-debug/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:282
        Value of: [webView _isPlayingAudio]
          Actual: false
        Expected: true
        
https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.MediaSessionTest.RemoteCommands
Comment 1 Radar WebKit Bug Importer 2021-02-10 21:13:29 PST
<rdar://problem/74220428>
Comment 2 Ryan Haddad 2021-02-10 21:14:15 PST
Pasted in the wrong history link. Here is the right one: 
https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.GPUProcess.CrashWhilePlayingVideo
Comment 3 Ryan Haddad 2021-02-10 21:16:50 PST
It looks like this test has been flaky on iOS for a while, but the macOS flakiness is relatively new (appears to have started with https://trac.webkit.org/changeset/272414/webkit according to test history)
Comment 4 Ryan Haddad 2021-02-10 21:21:04 PST
(In reply to Ryan Haddad from comment #3)
> It looks like this test has been flaky on iOS for a while
Looking more closely, that is known and tracked by https://bugs.webkit.org/show_bug.cgi?id=221499
Comment 5 Alexey Proskuryakov 2021-02-11 15:17:42 PST
Dupe of bug 221499?
Comment 6 Alexey Proskuryakov 2021-02-11 15:18:17 PST
Sorry, I now see that you said that - but should we dupe?
Comment 7 Ryan Haddad 2021-02-12 13:44:23 PST
(In reply to Alexey Proskuryakov from comment #6)
> Sorry, I now see that you said that - but should we dupe?
The macOS failure is still in need of investigation.
Comment 8 Chris Dumez 2021-05-04 15:59:10 PDT
Created attachment 427708 [details]
Patch
Comment 9 EWS 2021-05-05 07:48:12 PDT
Committed r277018 (237334@main): <https://commits.webkit.org/237334@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 427708 [details].
Comment 10 Chris Dumez 2021-05-05 12:15:19 PDT
Reopening since the test is still flaky.
Comment 11 Chris Dumez 2021-05-05 13:45:34 PDT
Created attachment 427803 [details]
Patch
Comment 12 youenn fablet 2021-05-06 00:47:51 PDT
Comment on attachment 427803 [details]
Patch

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

> Tools/ChangeLog:10
> +        relying on [webView _isPlayingAudio]. Also use a test page with a single video element instead

Does this uncover a potential issue with _isPlayingAudio in case of crash?

> Tools/TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:320
> +    [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.getElementsByTagName('video')[0].play() && true"];

Why not just doing @"play()"?
Comment 13 Chris Dumez 2021-05-06 07:47:45 PDT
(In reply to youenn fablet from comment #12)
> Comment on attachment 427803 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=427803&action=review
> 
> > Tools/ChangeLog:10
> > +        relying on [webView _isPlayingAudio]. Also use a test page with a single video element instead
> 
> Does this uncover a potential issue with _isPlayingAudio in case of crash?

Maybe, we'll see if this speculative fix is successful.

> > Tools/TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:320
> > +    [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.getElementsByTagName('video')[0].play() && true"];
> 
> Why not just doing @"play()"?

Good point, will update.
Comment 14 Chris Dumez 2021-05-06 07:48:41 PDT
Created attachment 427884 [details]
Patch
Comment 15 Chris Dumez 2021-05-06 07:50:08 PDT
(In reply to Chris Dumez from comment #13)
> (In reply to youenn fablet from comment #12)
> > Comment on attachment 427803 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=427803&action=review
> > 
> > > Tools/ChangeLog:10
> > > +        relying on [webView _isPlayingAudio]. Also use a test page with a single video element instead
> > 
> > Does this uncover a potential issue with _isPlayingAudio in case of crash?
> 
> Maybe, we'll see if this speculative fix is successful.

Although I don't think this has anything to do with crash recovery since _isPlayingAudio would refuse to become true *before* the crash on the bots.
Comment 16 EWS 2021-05-06 10:21:03 PDT
Committed r277101 (237403@main): <https://commits.webkit.org/237403@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 427884 [details].
Comment 17 Robert Jenner 2021-05-06 14:05:16 PDT
*** Bug 225475 has been marked as a duplicate of this bug. ***
Comment 18 Alexey Proskuryakov 2021-05-06 17:36:27 PDT
Given the above, do we need a separate bug about [webView _isPlayingAudio] not working reliably? Please file one if we do.
Comment 19 Chris Dumez 2021-05-10 08:56:03 PDT
No recent API test failures on macOS, it looks like this was successful.