-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extension trace issues (occasional -1 on TTI) #753
Comments
FMP is now coming from the trace event, thanks to #1066 |
andrewrota
pushed a commit
to andrewrota/lighthouse
that referenced
this issue
Jan 13, 2017
* Use fMP from chrome timings instead of calculating it ourselves. * Cleanup audit & driver * Cleanup unused functions * Fix fmp calculations * Fix test records fixes GoogleChrome#618, GoogleChrome#1010, GoogleChrome#890 and a part of GoogleChrome#753 pr: GoogleChrome#1066
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I spent a little while looking into the latest trace issues, which seem to be only occurring in the extension. Usual manifestation is a -1 on TTI due to an error inside it while calculating FMP, even though the exact same calculation of FMP on the same trace was successful in an earlier audit. news.google.com is a site that can often produce this. Information dump in case this takes me a little while to get back to or someone else wants to take over.
tl;dr, I'm currently thinking:
ts
order for FMP calculation. This would make us more correct but also unable to calculate FMP in more cases in the extension, at least.traceEvents
arrayts
vstts
and (if expected) which timestamp should win in those casesdebugString
s in the extension so it's clearer why -1s are popping up. They're in the pretty print version of the report for the CLI, so it would be nice to at leastlog.warn
them somewhere (inlighthouse-background.js
before populating the report, maybe?) so you don't have to set breakpoints just to see them on the extension side.What I've found so far:
The proximate cause is weird trace event ordering. When we're trying to find what we consider to be navigation start in a trace, we look for the first
navigationStart
event after theTracingStartedInPage
event. A typical example problem trace, highlighting theTracingStartedInPage
andnavigationStart
events:event.ts
("the tracing clock timestamp") in this example, bothnavigationStart
events occur before theTracingStartedInPage
event, so according tots
, there is no nav start event after tracing started.event.tts
("the thread clock timestamp of the event"), there is anavigationStart
event after the tracing started.All three events are in the same thread, so I don't see how they could have a different ordering based on the clock used. Interestingly, after many many runs I haven't been able to recreate this situation in the CLI, so I'm wondering if this is a weird timestamp bug somehow due to tracing from an extension.
I've uploaded an example trace to a gist, which you can look at in timeline viewer.
Other issues at work here:
The reason that one FMP calculation is successful while the next fails is that catapult/traceviewer is changing the array order of the trace events out from under us when we pass the trace into it between the two FMP calls. Specifically, it appears to sort the events purely by
ts
, which is not the order before we pass it in to traceviewer (it appears to be mostly, but not completely, intts
order).The calculation code assumes that a
navigationStart
event will be found afterTracingStartedInPage
. As stated above, if intts
order, we find thenavigationStart
where we expect it. When traceviewer sorts ints
order, nonavigationStart
is after tracing start, so we fail.We could prevent traceviewer from changing things by only passing a copy of the trace in or we could cache the FMP calculation, but...
We're sensitive to ordering of events in the trace, which we shouldn't be. In this case, if we explicitly order by
tts
before calculating FMP (as we implicitly depend on in the first run through FMP), we can continue to calculate successfully. However, we usets
for basically all other calculations, so it feels like we should be explicitly ordering byts
, always fail at calculating FMP in this situation, and hope this can be fixed upstream.When Chrome 54 hits stable, we'll have a totally new way of calculating FMP which won't be sensitive to this, so some of this will soon (~end of October) be irrelevant. However, we should be more certain on the timestamps we use, be insensitive to trace event ordering, and we'll still need to know which
navigationStart
event we care about for other calculations.The text was updated successfully, but these errors were encountered: