catapult-project / catapult

Deprecated Catapult GitHub. Please instead use http://crbug.com "Speed>Benchmarks" component for bugs and https://chromium.googlesource.com/catapult for downloading and editing source code..
https://chromium.googlesource.com/catapult
BSD 3-Clause "New" or "Revised" License
1.93k stars 563 forks source link

IPC flow IDs are not unique #1199

Open yuhao opened 9 years ago

yuhao commented 9 years ago

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

yuhao commented 9 years ago

Here is what's happening.

screen shot 2015-08-12 at 7 00 09 pm

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

yuhao commented 9 years ago

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?

dj2 commented 9 years ago

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?

yuhao commented 9 years ago

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?