summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authoramistry <amistry@chromium.org>2016-03-17 17:48:43 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-18 00:49:35 +0000
commit86045e737391ccffa0383eaa51c6c2bc858fa0ca (patch)
treef6d4b26011bee4252a2dfdb00d141ed7d8a29063 /mojo
parent48d7378cc2e2cc76c9cf0bfcd05413f8678662cb (diff)
downloadchromium_src-86045e737391ccffa0383eaa51c6c2bc858fa0ca.zip
chromium_src-86045e737391ccffa0383eaa51c6c2bc858fa0ca.tar.gz
chromium_src-86045e737391ccffa0383eaa51c6c2bc858fa0ca.tar.bz2
[mojo-edk] Shutdown a node's bootstrap parent channel outside its lock.
On OSX, NodeChannel::ShutDown() calls into NodeController::GetMachPortRelay() which acquires |parent_lock_| and deadlocks due to a recursuve lock acquisition. BUG=582468 Review URL: https://codereview.chromium.org/1808233003 Cr-Commit-Position: refs/heads/master@{#381852}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/edk/system/node_controller.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/mojo/edk/system/node_controller.cc b/mojo/edk/system/node_controller.cc
index 3733c6c..30b331f 100644
--- a/mojo/edk/system/node_controller.cc
+++ b/mojo/edk/system/node_controller.cc
@@ -500,15 +500,20 @@ void NodeController::AcceptIncomingMessages() {
void NodeController::DropAllPeers() {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
+ std::vector<scoped_refptr<NodeChannel>> all_peers;
{
base::AutoLock lock(parent_lock_);
if (bootstrap_parent_channel_) {
- bootstrap_parent_channel_->ShutDown();
- bootstrap_parent_channel_ = nullptr;
+ // |bootstrap_parent_channel_| isn't null'd here becuase we rely on its
+ // existence to determine whether or not this is the root node. Once
+ // bootstrap_parent_channel_->ShutDown() has been called,
+ // |bootstrap_parent_channel_| is essentially a dead object and it doesn't
+ // matter if it's deleted now or when |this| is deleted.
+ // Note: |bootstrap_parent_channel_| is only modified on the IO thread.
+ all_peers.push_back(bootstrap_parent_channel_);
}
}
- std::vector<scoped_refptr<NodeChannel>> all_peers;
{
base::AutoLock lock(peers_lock_);
for (const auto& peer : peers_)