Open yuhao opened 9 years ago
Here is what's happening.
In the browser main thread, ChannelProxy::Context::OnDispatchMessage sends two messages to the IO thread using PostTask (only one is highlighted in the screenshot). Each message then does an IPC once then get to the IO thread. The problem is that these two messages share the same ID.
@vmpstr @dj2
I don't know if this is a bug, but ChannelProxy::Context::OnDispatchMessage is only taking one piece of message as its argument (https://code.google.com/p/chromium/codesearch#chromium/src/ipc/ipc_channel_proxy.cc&sq=package:chromium&l=260&q=ChannelProxy::Context::OnDispatchMessage). How come it ends up sending two pieces messages to the IO thread?
I don't understand what you mean. Are you asking why it has an event with just name and a second one with class and line? What does 'sending two pieces messages to the IO thread' mean?
I am saying that:
1) I found where the flow id duplication of IPC is coming from. In the screenshot, there are two PostTasks under ChannelProxy::Context::OnDispatchMessage from CrBrowserMain to Child_IOThread. Each PostTask carries an IPC message. When the PostTask gets to the Child_IOThread, it sends the message through IPC. I found that these two messages have the same flow ID.
2) I was confused why there are two messages under ChannelProxy::Context::OnDispatchMessage, which only takes one piece of message as the argument. Maybe there is a bug here that we send a redundant message?
A sample trace: https://drive.google.com/a/google.com/file/d/0B6-gGzXfT-VNdzdyMGlrdng2UFU/view?usp=sharing
Search for 0x81df1c02.
The IPC flow ID seems to be set here: https://code.google.com/p/chromium/codesearch#chromium/src/ipc/ipc_message.cc&rcl=1438874967&l=61&sq=package:chromium
It's possible to have collision, as described here (https://code.google.com/p/chromium/codesearch#chromium/src/ipc/ipc_message.cc&rcl=1438874967&l=32&sq=package:chromium). However, 14 bits is large enough and the number of IPC messages in the trace is way fewer. So I suspect that this is because the same message is used more than once.
I will come back with more info. @natduca @dj2