Title: [217830] trunk/Source/_javascript_Core
Revision
217830
Author
[email protected]
Date
2017-06-06 08:15:10 -0700 (Tue, 06 Jun 2017)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (217829 => 217830)


--- trunk/Source/_javascript_Core/ChangeLog	2017-06-06 14:53:57 UTC (rev 217829)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-06-06 15:15:10 UTC (rev 217830)
@@ -1,3 +1,18 @@
+2017-06-06  Carlos Garcia Campos  <[email protected]>
+
+        [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):
+
 2017-06-05  Saam Barati  <[email protected]>
 
         Try to fix features.json by adding an ESNext section.

Modified: trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorGlib.cpp (217829 => 217830)


--- trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorGlib.cpp	2017-06-06 14:53:57 UTC (rev 217829)
+++ trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorGlib.cpp	2017-06-06 15:15:10 UTC (rev 217830)
@@ -307,16 +307,19 @@
 
 void RemoteInspector::receivedCloseMessage(unsigned targetIdentifier)
 {
-    std::lock_guard<Lock> lock(m_mutex);
-    RemoteControllableTarget* target = m_targetMap.get(targetIdentifier);
-    if (!target)
-        return;
+    RefPtr<RemoteConnectionToTarget> connectionToTarget;
+    {
+        std::lock_guard<Lock> lock(m_mutex);
+        RemoteControllableTarget* target = m_targetMap.get(targetIdentifier);
+        if (!target)
+            return;
 
-    auto connectionToTarget = m_targetConnectionMap.take(targetIdentifier);
+        connectionToTarget = m_targetConnectionMap.take(targetIdentifier);
+        updateHasActiveDebugSession();
+    }
+
     if (connectionToTarget)
         connectionToTarget->close();
-
-    updateHasActiveDebugSession();
 }
 
 void RemoteInspector::setup(unsigned targetIdentifier)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to