Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Issue 240133005: Mojo: Make some attempts towards fixing remote message pipe closure. (Closed)

Created:
6 years, 8 months ago by viettrungluu
Modified:
6 years, 8 months ago
CC:
chromium-reviews, Aaron Boodman, darin (slow to review), viettrungluu+watch_chromium.org, ben+mojo_chromium.org, abarth-chromium
Visibility:
Public.

Description

Mojo: Make some attempts towards fixing remote message pipe closure. It's not quite right yet (I still need to fix how they get started -- i.e., attached and run -- since that races in a poor way with how they get closed), but I think I'm getting closer. There's an intentional cycle of ref-counted objects, between the ProxyMessagePipeEndpoint and the Channel, which needs to be broken when one of the (real) endpoints of the message pipe is closed. The picture is: LocalMPE-ProxyMPE-Channel <-----> Channel-ProxyMPE-LocalMPE When a LocalMessagePipeEndpoint is closed, ultimately the other LocalMessagePipeEndpoint needs to be informed ("OnPeerClosed"), and the two ProxyMessagePipeEndpoints can be torn down. There are many difficulties, however. First, while a ProxyMessagePipeEndpoint may be torn down, its entry (with its local ID) may not be removed from the Channel until it's known that the other side will not send messages to that ID (because you can't re-use that ID until then). Basically, this amounts to notifying the other side and receiving an ack. (We can mark the entry in the Channel with a suitable "zombie" state to handle this.) Second, both LocalMessagePipeEndpoints may be closed "simultaneously" -- resulting in the removal notification messages "crossing paths". Of course, once you receive a removal notification for a given ID, you know the other side will not send any more messages to that ID. So, there's no need to send an ack in that case. Now, there are lock order issues, so that removal of an ID from a channel (upon receiving a removal message) races with the LocalMessagePipeEndpoint (on the "local" side) being closed, so you have to handle that. Then there are races with the ProxyMessagePipeEndpoint being attached and run (and possibly receiving a removal message). (This CL doesn't address all those issues.) Finally, note that sometimes you have to keep the ProxyMessagePipeEndpoint alive past "OnPeerClose". E.g., it's valid for you to write a whole bunch of messages to a MessagePipe endpoint, and then immediately close it. The ProxyMessagePipeEndpoint must stay alive until it's been attached/run and sent out all those messages (and a remove message). R=darin@chromium.org BUG=360081 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=264716

Patch Set 1 #

Total comments: 4

Patch Set 2 : review comments #

Patch Set 3 : fix some locking issues #

Unified diffs Side-by-side diffs Delta from patch set Stats (+391 lines, -132 lines) Patch
M mojo/embedder/embedder.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/system/channel.h View 1 2 3 chunks +35 lines, -6 lines 0 comments Download
M mojo/system/channel.cc View 1 2 11 chunks +211 lines, -45 lines 0 comments Download
M mojo/system/local_message_pipe_endpoint.h View 1 chunk +2 lines, -2 lines 0 comments Download
M mojo/system/local_message_pipe_endpoint.cc View 3 chunks +9 lines, -7 lines 0 comments Download
M mojo/system/message_in_transit.h View 1 chunk +3 lines, -1 line 0 comments Download
M mojo/system/message_in_transit.cc View 1 chunk +5 lines, -1 line 0 comments Download
M mojo/system/message_pipe.h View 1 chunk +2 lines, -1 line 0 comments Download
M mojo/system/message_pipe.cc View 5 chunks +28 lines, -26 lines 0 comments Download
M mojo/system/message_pipe_dispatcher.cc View 2 chunks +18 lines, -2 lines 0 comments Download
M mojo/system/message_pipe_endpoint.h View 3 chunks +6 lines, -3 lines 0 comments Download
M mojo/system/message_pipe_endpoint.cc View 2 chunks +10 lines, -1 line 0 comments Download
M mojo/system/proxy_message_pipe_endpoint.h View 3 chunks +11 lines, -10 lines 0 comments Download
M mojo/system/proxy_message_pipe_endpoint.cc View 6 chunks +41 lines, -23 lines 0 comments Download
M mojo/system/remote_message_pipe_unittest.cc View 1 2 chunks +8 lines, -4 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
viettrungluu
6 years, 8 months ago (2014-04-16 18:15:14 UTC) #1
darin (slow to review)
LGTM :) https://codereview.chromium.org/240133005/diff/1/mojo/system/channel.cc File mojo/system/channel.cc (right): https://codereview.chromium.org/240133005/diff/1/mojo/system/channel.cc#newcode75 mojo/system/channel.cc:75: "(hopefully all zombies)"; nit: indentation https://codereview.chromium.org/240133005/diff/1/mojo/system/remote_message_pipe_unittest.cc File ...
6 years, 8 months ago (2014-04-16 21:33:42 UTC) #2
viettrungluu
The CQ bit was checked by viettrungluu@chromium.org
6 years, 8 months ago (2014-04-16 22:24:48 UTC) #3
viettrungluu
Thanks. https://codereview.chromium.org/240133005/diff/1/mojo/system/channel.cc File mojo/system/channel.cc (right): https://codereview.chromium.org/240133005/diff/1/mojo/system/channel.cc#newcode75 mojo/system/channel.cc:75: "(hopefully all zombies)"; On 2014/04/16 21:33:43, darin wrote: ...
6 years, 8 months ago (2014-04-16 22:25:01 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/viettrungluu@chromium.org/240133005/10016
6 years, 8 months ago (2014-04-16 22:25:29 UTC) #5
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 8 months ago (2014-04-16 23:28:32 UTC) #6
commit-bot: I haz the power
Try jobs failed on following builders: tryserver.chromium on win_chromium_compile_dbg
6 years, 8 months ago (2014-04-16 23:28:32 UTC) #7
viettrungluu
The CQ bit was checked by viettrungluu@chromium.org
6 years, 8 months ago (2014-04-17 22:24:59 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/viettrungluu@chromium.org/240133005/30001
6 years, 8 months ago (2014-04-17 22:25:18 UTC) #9
commit-bot: I haz the power
6 years, 8 months ago (2014-04-18 04:40:11 UTC) #10
Message was sent while issue was closed.
Change committed as 264716

Powered by Google App Engine
This is Rietveld 408576698