Bug 314593

Summary: MediaUsageManagerCocoa::removeMediaSession doesn't clear UsageTrackingAgent state when being released
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: New BugsAssignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Brent Fulgham
Reported 2026-05-11 16:30:45 PDT
WebKitTestRunner streams incoming test cases and rarely shuts down or cleans up like a user might when closing a tab. The logic in the various WebKitTestRunner test reset methods is meant to handle this, but we seem to have overlooked UsageTracking, which can lead to the system shutting the test runner down for holding too many active XPC connections to that process. We need to clean up when switching tests on some cadence so that we don't exceed the process limit and cause a spurious WKTR crash.
Attachments
Brent Fulgham
Comment 1 2026-05-11 16:32:04 PDT
Example: In a recent test I ran trying to stress a single test (by iterating 500 times), WKTR was killed for exceeding 2048 kqworkloops (hit 2049). Of those ~2049 workloops, 1994 (97%) were leaked `com.apple.NSXPCConnection.m-user.com.apple.UsageTrackingAgent` connections. It seems like each test iteration likely triggers a new XPC connection to that service that never gets torn down within the long-lived WebKitTestRunner process.
Radar WebKit Bug Importer
Comment 2 2026-05-11 16:32:18 PDT
Brent Fulgham
Comment 3 2026-05-11 16:55:00 PDT
EWS
Comment 4 2026-05-12 20:42:43 PDT
Committed 313125@main (749fddf048e0): <https://commits.webkit.org/313125@main> Reviewed commits have been landed. Closing PR #64713 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.