Bug 192810

Summary: REGRESSION: [iOS] API test TestWebKitAPI._WKDownload.OriginatingWebView is a flaky failure
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, commit-queue, david_quesada, jlewis3, tsavell, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
achristensen: review+, achristensen: commit-queue-
Patch for landing none

Description Ryan Haddad 2018-12-18 09:31:27 PST
The following API test appears to be a flaky failure on iOS bots:

    TestWebKitAPI._WKDownload.OriginatingWebView
        
        /Volumes/Data/slave/ios-simulator-12-release/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm:261
        Value of: !([download originatingWebView])
          Actual: false
        Expected: true

https://build.webkit.org/builders/Apple%20iOS%2012%20Simulator%20Release%20WK2%20(Tests)/builds/1607/steps/run-api-tests/logs/stdio
Comment 1 Radar WebKit Bug Importer 2018-12-18 09:38:40 PST
<rdar://problem/46812536>
Comment 2 Ryan Haddad 2018-12-18 09:47:16 PST
It failed about 50% of the time for me locally when I ran:
run-api-tests --debug --ios-simulator _WKDownload.OriginatingWebView
Comment 3 David Quesada 2018-12-18 14:39:19 PST
When I see this fail, it doesn't appear that the originatingWebView has any remaining strong references, but is in the autorelease pool, likely as a result of handling other messages that have been sent to the UI process while the test has run. The test seems to pass (I've hit at least 20 successes in a row, compared to 3/10 successes without any changes) if I defer checking the originatingWebView to the next turn of the runloop. Patch coming up.
Comment 4 David Quesada 2018-12-18 14:45:41 PST
Created attachment 357614 [details]
Patch
Comment 5 Alex Christensen 2018-12-18 15:13:56 PST
Comment on attachment 357614 [details]
Patch

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

> Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm:260
> +    WTF::callOnMainThread([retainedDownload = RetainPtr<_WKDownload> { download }] {

[download = retainPtr(download)]
Comment 6 David Quesada 2018-12-18 15:21:29 PST
Created attachment 357621 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2018-12-18 15:59:43 PST
Comment on attachment 357621 [details]
Patch for landing

Clearing flags on attachment: 357621

Committed r239359: <https://trac.webkit.org/changeset/239359>
Comment 8 WebKit Commit Bot 2018-12-18 15:59:44 PST
All reviewed patches have been landed.  Closing bug.