New issue
Advanced search Search tips

Issue 616787 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 642714



Sign in to add a comment

TimeTicks may not be consistent cross-process - may lead to bugs

Project Member Reported by majidvp@chromium.org, Jun 2 2016

Issue description

Unfortunately due to limitation on windows, we cannot always assume that we have a monotonic clock that is consistent across processes. In particular anytime we fallback to using |timeGetTime()| then there cross process See [1,2] for more information.

This means that any logic that relies on comparing timeticks that are from different processes can be experience unexpected skew which may lead to bugs.

Here are a few examples of when this occurs:
 - Anytime we expose a timeticks from a non-renderer process to the web (e.g., resource timing, high-resolution event timestamp)
 - Anytime we compare an event timestamp (generated in UI process) to TimeTicks::Now() in renderer. e.g., when computing Event.Latency.Renderer2
 - Anytime we compare an network resource timestamp to a timestamp in a different process e.g., https://code.chromium.org/chromium/src/content/browser/frame_host/render_frame_host_impl.cc?sq=package:chromium&dr=CSs&rcl=1464852061&l=1317 

There are several ways to deal with this issue:

1. Try to measure the skew and adjust for it. This is the approach taken by InterProcessTimeTicksConverter (IPTTC) which relies on at least two IPC between involved processes. We probably need a different (less expensive) approach for event timestamps.
2. Do not compare timestamps across processes when clock is not consistent. For example we could do this for some UMA metrics. 
 

[1] https://docs.google.com/document/d/1RcaOZ1G8ttAez9YuilvbDJCkCaYuLKqNkVpQvIBqsvM/edit
[2] go/timeticks

 
Cc: charliea@chromium.org
I would also like to know answer to the following two question: 

Can we find an upper bound for this skew? 

Is the skew only an offset or can it also include a scale factor (e.g., different frequency)? According to InterProcessTimeTicksConverter the clock skew require scaling but this is a bit surprising given that |timeGetTime()| source of truth should be the same across processes.

My suggestion would be lots and lots of Google searches trying to synthesize answers from different sources. There's a lot of conflicting answers out there, but eventually you'll probably land on something written by someone who's clearly an expert and has a definitive opinion (whether it be on MSDN or elsewhere).
Blocking: 642714

Sign in to add a comment