Commit 86045e73 authored by amistry's avatar amistry Committed by Commit bot

[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}
parent 48d7378c
...@@ -500,15 +500,20 @@ void NodeController::AcceptIncomingMessages() { ...@@ -500,15 +500,20 @@ void NodeController::AcceptIncomingMessages() {
void NodeController::DropAllPeers() { void NodeController::DropAllPeers() {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
std::vector<scoped_refptr<NodeChannel>> all_peers;
{ {
base::AutoLock lock(parent_lock_); base::AutoLock lock(parent_lock_);
if (bootstrap_parent_channel_) { if (bootstrap_parent_channel_) {
bootstrap_parent_channel_->ShutDown(); // |bootstrap_parent_channel_| isn't null'd here becuase we rely on its
bootstrap_parent_channel_ = nullptr; // 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_); base::AutoLock lock(peers_lock_);
for (const auto& peer : peers_) for (const auto& peer : peers_)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment