Changeset 217830 in webkit


Ignore:
Timestamp:
Jun 6, 2017 8:15:10 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Web Process deadlock when closing the remote inspector frontend
https://bugs.webkit.org/show_bug.cgi?id=172973

Reviewed by Žan Doberšek.

We are taking the remote inspector mutex twice. First close message is received, and receivedCloseMessage()
takes the mutex. Then RemoteConnectionToTarget::close() is called that, when connected, calls
PageDebuggable::disconnect() that ends up calling RemoteInspector::updateTarget() that also takes the remote
inspector mutex. We should release the mutex before calling RemoteConnectionToTarget::close().

  • inspector/remote/glib/RemoteInspectorGlib.cpp:

(Inspector::RemoteInspector::receivedCloseMessage):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r217819 r217830  
     12017-06-06  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Web Process deadlock when closing the remote inspector frontend
     4        https://bugs.webkit.org/show_bug.cgi?id=172973
     5
     6        Reviewed by Žan Doberšek.
     7
     8        We are taking the remote inspector mutex twice. First close message is received, and receivedCloseMessage()
     9        takes the mutex. Then RemoteConnectionToTarget::close() is called that, when connected, calls
     10        PageDebuggable::disconnect() that ends up calling RemoteInspector::updateTarget() that also takes the remote
     11        inspector mutex. We should release the mutex before calling RemoteConnectionToTarget::close().
     12
     13        * inspector/remote/glib/RemoteInspectorGlib.cpp:
     14        (Inspector::RemoteInspector::receivedCloseMessage):
     15
    1162017-06-05  Saam Barati  <sbarati@apple.com>
    217
  • trunk/Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp

    r216582 r217830  
    308308void RemoteInspector::receivedCloseMessage(unsigned targetIdentifier)
    309309{
    310     std::lock_guard<Lock> lock(m_mutex);
    311     RemoteControllableTarget* target = m_targetMap.get(targetIdentifier);
    312     if (!target)
    313         return;
    314 
    315     auto connectionToTarget = m_targetConnectionMap.take(targetIdentifier);
     310    RefPtr<RemoteConnectionToTarget> connectionToTarget;
     311    {
     312        std::lock_guard<Lock> lock(m_mutex);
     313        RemoteControllableTarget* target = m_targetMap.get(targetIdentifier);
     314        if (!target)
     315            return;
     316
     317        connectionToTarget = m_targetConnectionMap.take(targetIdentifier);
     318        updateHasActiveDebugSession();
     319    }
     320
    316321    if (connectionToTarget)
    317322        connectionToTarget->close();
    318 
    319     updateHasActiveDebugSession();
    320323}
    321324
Note: See TracChangeset for help on using the changeset viewer.