summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-12-14 22:18:14 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-15 06:18:52 +0000
commita0c8ebc44e574bf12e7ffca0d492b9859f914a4d (patch)
tree870c74b579cecf8e49d5e103b3b935b88d69d013 /mojo
parentc8b6dbdf55468e6dd5a218bb62721f41598f7791 (diff)
downloadchromium_src-a0c8ebc44e574bf12e7ffca0d492b9859f914a4d.zip
chromium_src-a0c8ebc44e574bf12e7ffca0d492b9859f914a4d.tar.gz
chromium_src-a0c8ebc44e574bf12e7ffca0d492b9859f914a4d.tar.bz2
Fix shutdown assert with the new Mojo EDK.
This was seen on Windows tryjobs enabling the new EDK. The problem was that RoutedRawChannel was destroying the channel on write errors, while normally (without multiplexing) this is only done on read errors. So MessagePipeDispatcher thought it had a channel_ (which it didn't use because it knew it had seen a write error) and it was asserting at shutdown. The fix is to make RoutedRawChannel match non-multiplexed MessagePipeDispatcher's destruction of the channel only when read errors occur. BUG=561803 Review URL: https://codereview.chromium.org/1526563004 Cr-Commit-Position: refs/heads/master@{#365175}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/edk/system/message_pipe_dispatcher.cc4
-rw-r--r--mojo/edk/system/routed_raw_channel.cc9
2 files changed, 9 insertions, 4 deletions
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
index b4938fe..beb1824 100644
--- a/mojo/edk/system/message_pipe_dispatcher.cc
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -618,7 +618,7 @@ MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
uint32_t* num_dispatchers,
MojoReadMessageFlags flags) {
lock().AssertAcquired();
- if (channel_) {
+ if (transferable_ && channel_) {
channel_->EnsureLazyInitialized();
} else if (!transferable_) {
if (non_transferable_state_ == WAITING_FOR_READ_OR_WRITE) {
@@ -718,7 +718,7 @@ MojoResult MessagePipeDispatcher::AddAwakableImplNoLock(
uintptr_t context,
HandleSignalsState* signals_state) {
lock().AssertAcquired();
- if (channel_) {
+ if (transferable_ && channel_) {
channel_->EnsureLazyInitialized();
} else if (!transferable_ &&
non_transferable_state_ == WAITING_FOR_READ_OR_WRITE) {
diff --git a/mojo/edk/system/routed_raw_channel.cc b/mojo/edk/system/routed_raw_channel.cc
index 825fc2fa..b985f56 100644
--- a/mojo/edk/system/routed_raw_channel.cc
+++ b/mojo/edk/system/routed_raw_channel.cc
@@ -132,8 +132,13 @@ void RoutedRawChannel::OnReadMessage(
void RoutedRawChannel::OnError(Error error) {
DCHECK(internal::g_io_thread_task_runner->RunsTasksOnCurrentThread());
- channel_->Shutdown();
- channel_ = nullptr;
+ // This needs to match non-multiplexed MessagePipeDispatcher's destruction of
+ // the channel only when read errors occur.
+ if (error != ERROR_WRITE) {
+ channel_->Shutdown();
+ channel_ = nullptr;
+ }
+
if (routes_.empty()) {
delete this;
return;