Changeset 196730 in webkit


Ignore:
Timestamp:
Feb 17, 2016 4:37:50 PM (8 years ago)
Author:
BJ Burg
Message:

RemoteInspector deadlocks if _WKAutomationDelegate creates/registers a target synchronously
https://bugs.webkit.org/show_bug.cgi?id=154359
<rdar://problem/24708897>

Reviewed by Joseph Pecoraro.

RemoteInspector always grabs a lock whenever receiving or sending XPC messages. If it
forwards a new session request via _WKAutomationDelegate, and the client synchronously
creates and registers a session, then RemoteInspector will try to grab the lock again
while adding the session to its registry, causing a deadlock.

  • UIProcess/Cocoa/AutomationClient.mm:

(WebKit::AutomationClient::requestAutomationSession): Add a dispatch_async() to
protect clients from accidentally deadlocking. They shouldn't have to care about
RemoteInspector's locking mechanisms.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r196728 r196730  
     12016-02-17  Brian Burg  <bburg@apple.com>
     2
     3        RemoteInspector deadlocks if _WKAutomationDelegate creates/registers a target synchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=154359
     5        <rdar://problem/24708897>
     6
     7        Reviewed by Joseph Pecoraro.
     8
     9        RemoteInspector always grabs a lock whenever receiving or sending XPC messages. If it
     10        forwards a new session request via _WKAutomationDelegate, and the client synchronously
     11        creates and registers a session, then RemoteInspector will try to grab the lock again
     12        while adding the session to its registry, causing a deadlock.
     13
     14        * UIProcess/Cocoa/AutomationClient.mm:
     15        (WebKit::AutomationClient::requestAutomationSession): Add a dispatch_async() to
     16        protect clients from accidentally deadlocking. They shouldn't have to care about
     17        RemoteInspector's locking mechanisms.
     18
    1192016-02-17  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebKit2/UIProcess/Cocoa/AutomationClient.mm

    r196562 r196730  
    7070void AutomationClient::requestAutomationSession(const String& sessionIdentifier)
    7171{
    72     if (m_delegateMethods.requestAutomationSession)
    73         [m_delegate.get() _processPool:m_processPool didRequestAutomationSessionWithIdentifier:sessionIdentifier];
     72    // Force clients to create and register a session asynchronously. Otherwise,
     73    // RemoteInspector will try to acquire its lock to register the new session and
     74    // deadlock because it's already taken while handling XPC messages.
     75    dispatch_async(dispatch_get_main_queue(), ^{
     76        if (m_delegateMethods.requestAutomationSession)
     77            [m_delegate.get() _processPool:m_processPool didRequestAutomationSessionWithIdentifier:sessionIdentifier];
     78    });
    7479}
    7580
Note: See TracChangeset for help on using the changeset viewer.