Bug 233224

Summary: [ Monterey ] TestWebKitAPI.WebSocket.PageWithAttributedBundleIdentifierDestroyed (API-test) is a constant timeout
Product: WebKit Reporter: Robert Jenner <jenner>
Component: WebKit APIAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, darin, webkit-bot-watchers-bugzilla, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch darin: review+

Description Robert Jenner 2021-11-16 16:58:15 PST
TestWebKitAPI.WebSocket.PageWithAttributedBundleIdentifierDestroyed is a constant timeout on macOS Monterey. 

HISTORY:
https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.WebSocket.PageWithAttributedBundleIdentifierDestroyed
Comment 1 Radar WebKit Bug Importer 2021-11-16 16:58:52 PST
<rdar://problem/85482210>
Comment 2 Robert Jenner 2021-11-19 11:50:17 PST
I was able to reproduce this timeout on a Release ToT build. Using the following test:

Run-api-tests --release TestWebKitAPI.WebSocket.PageWithAttributedBundleIdentifierDestroyed

I do want to note that I was not able to reproduce this with a Debug or a Production build. I had to specifically download a Release build, and that's where I was easily able to reproduce the timeout.
Comment 3 Alex Christensen 2021-12-20 10:44:11 PST
It seems that setting _attributedBundleIdentifier to a bundle id that doesn't exist causes it to be unable to make a network request.
Comment 4 Alex Christensen 2021-12-20 10:56:03 PST
Created attachment 447611 [details]
Patch
Comment 5 Darin Adler 2021-12-20 12:19:12 PST
Comment on attachment 447611 [details]
Patch

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

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1767
> +    if (!parameters.attributedBundleIdentifier().startsWith("com.apple.webkit.test.bundle.identifier"))

Building the name of the test bundle right into the binary is usually something we try very hard to avoid. Isn’t there some other way the test could inject the evidence that it’s a test configuration?
Comment 6 Darin Adler 2021-12-20 12:19:46 PST
Comment on attachment 447611 [details]
Patch

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

>> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1767
>> +    if (!parameters.attributedBundleIdentifier().startsWith("com.apple.webkit.test.bundle.identifier"))
> 
> Building the name of the test bundle right into the binary is usually something we try very hard to avoid. Isn’t there some other way the test could inject the evidence that it’s a test configuration?

Like a separate boolean in the parameters.
Comment 7 Alex Christensen 2021-12-20 12:47:07 PST
Created attachment 447622 [details]
Patch
Comment 8 Alex Christensen 2021-12-20 13:59:19 PST
https://trac.webkit.org/changeset/287275/webkit
Comment 9 Alex Christensen 2021-12-22 09:42:19 PST
r287359 enabled another test fixed by this.