Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: af0162d45a8f33a9a2687c330ac4d167b7ae5fa7
      
https://github.com/WebKit/WebKit/commit/af0162d45a8f33a9a2687c330ac4d167b7ae5fa7
  Author: Chris Dumez <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebKit/Platform/cocoa/WebPrivacyHelpers.h
    M Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp
    M Source/WebKit/UIProcess/API/APIContentRuleListStore.h
    M Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

  Log Message:
  -----------
  REGRESSION (297757@main): [ Tahoe wk2 debug arm64 ] Multiple 
http/tests/iframe-monitor tests are consistent timeouts
https://bugs.webkit.org/show_bug.cgi?id=307300
rdar://169934202

Reviewed by Basuke Suzuki.

297757@main fixed parallel compilations for the same identifier racing on the 
same
file by replacing per-instance work queues with a single static serial WorkQueue
shared across all ContentRuleListStore instances. This was too aggressive: it
serializes all operations (compiles, reads, removes) across all stores globally,
even when they operate on different directories and cannot conflict.

On Tahoe bots running multiple WebKitTestRunner instances, this causes two 
problems:

1. Cross-process filesystem contention: platformCompileResourceMonitorRuleList()
   was using [WKContentRuleListStore defaultStore] whose directory is shared 
across
   all WKTR instances. Multiple processes writing the same file concurrently 
makes
   compilation extremely slow.

2. Within-process queue starvation: the built-in resource monitor rule list
   compilation (triggered by page navigation via 
ResourceMonitorURLsController::prepare())
   and the test's rule list compilation both serialize on the same global queue.
   If the built-in list is large, it blocks the test's compilation past the 
timeout.

Fix both issues:

- Replace the global static serial queue with a per-directory serial WorkQueue,
  keyed by store path. Stores sharing the same directory serialize on the same
  queue (preventing the race that 297757@main fixed), while stores with 
different
  directories operate in parallel. The queue map is reference-counted so entries
  are cleaned up when the last store for a given path is destroyed.

- Have platformCompileResourceMonitorRuleList() use the per-pid store configured
  by WKTR (via ResourceMonitorURLsController) instead of the shared default 
store,
  eliminating cross-process filesystem contention.

* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebKit/Platform/cocoa/WebPrivacyHelpers.h:
(WebKit::ResourceMonitorURLsController::contentRuleListStore const):
* Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:
(API::workQueueMap):
(API::retainWorkQueueForPath):
(API::releaseWorkQueueForPath):
(API::ContentRuleListStore::ContentRuleListStore):
(API::ContentRuleListStore::~ContentRuleListStore):
(API::ContentRuleListStore::lookupContentRuleListFile):
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
(API::ContentRuleListStore::compileContentRuleListFile):
(API::ContentRuleListStore::removeContentRuleListFile):
(API::ContentRuleListStore::getContentRuleListSource):
* Source/WebKit/UIProcess/API/APIContentRuleListStore.h:
* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformCompileResourceMonitorRuleList):

Canonical link: https://commits.webkit.org/312745@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to