Index: runtime/bin/dbg_message.cc |
diff --git a/runtime/bin/dbg_message.cc b/runtime/bin/dbg_message.cc |
index 30eb7307216ce8beefcf2187106acf4f098582a3..e50754402223887f4360a5b6c438f3caf0c959ee 100644 |
--- a/runtime/bin/dbg_message.cc |
+++ b/runtime/bin/dbg_message.cc |
@@ -1096,8 +1096,18 @@ void DbgMsgQueue::MessageLoop() { |
while (true) { |
// Handle all available vm service messages, up to a resume |
// request. |
- if (Dart_HandleServiceMessages()) { |
- break; |
+ while (Dart_HasServiceMessages()) { |
+ // Release the message queue lock before handling service |
+ // messages. This allows notifications to come in while we are |
+ // processing long requests and avoids deadlock with the PortMap |
+ // lock in the vm. |
+ msg_queue_lock_.Exit(); |
+ bool resume = Dart_HandleServiceMessages(); |
+ msg_queue_lock_.Enter(); |
+ if (resume) { |
+ // Resume requested through the vm service. |
+ break; |
+ } |
} |
// Handle all available debug messages, up to a resume request. |