Skip to content
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

core(tracing): support missing TracingStartedInBrowser #7122

Merged
merged 6 commits into from
Apr 29, 2019

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Jan 31, 2019

Summary
I'm not convinced we should actually merge this, but I think it's a good starting point for discussion with someone who knows tracing in and out. There are cases where TracingStartedInBrowser just isn't there. In newer chrome, navStart has a bunch of extra useful data we can leverage to try to find the main frame. We could even line up the URLs with the requested URL if we wanted.

UPDATE: With m74 hitting stable this has become essential, ~70% of cases in DZL smoketests started failing with NO_TRACING_STARTED. We gotta do something, but DT team input obviously wanted :)

Related Issues/PRs
closes #7118

@patrickhulce patrickhulce changed the title core(tracing): support missing TracingStartedInBrowser [DO NOT MERGE] core(tracing): support missing TracingStartedInBrowser Feb 4, 2019
@patrickhulce
Copy link
Collaborator Author

I'm just gonna close this, it's messed up on chrome://version but it hasn't seemed to spread elsewhere, so who cares 🤷‍♂️

@brendankenny
Copy link
Member

perhaps #7122 is more of a problem than we realized :(

FWIW, I'd be good with reopening. Refactoring to findMainFrameIds() was a nice way to make it clear we don't really care about the actual start event, just the IDs. As long as we're conservative with this it seems ok.

@patrickhulce patrickhulce reopened this Apr 24, 2019
@patrickhulce patrickhulce changed the title [DO NOT MERGE] core(tracing): support missing TracingStartedInBrowser core(tracing): support missing TracingStartedInBrowser Apr 24, 2019
Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but @paulirish should we talk to some trace folks before landing this and forgetting about it?

lighthouse-core/lib/traces/tracing-processor.js Outdated Show resolved Hide resolved
@patrickhulce
Copy link
Collaborator Author

Yes indeed @paulirish if you could pull in @a1ph or another DevTools tracing buff perhaps to sanity check this? :)

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double LGTM!

// Support the case where everything else fails, see https://github.com/GoogleChrome/lighthouse/issues/7118.
// If we can't find either TracingStarted event, then we'll fallback to the first navStart that
// looks like it was loading the main frame with a real URL. Because the schema for this event
// has changed across Chrome versions, we'll be extra defensive about finding this case.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏆

@@ -237,6 +237,27 @@ class TraceProcessor {
}
}

// Support the case where everything else fails, see https://github.com/GoogleChrome/lighthouse/issues/7118.
// If we can't find either TracingStarted event, then we'll fallback to the first navStart that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back in 2016, we used a diff hack.. which thread had the most events: 1c62db3#diff-a6b18ac2e75e02d6c1e53d586a319643R101
(it could be improved now to just consider renderer threads).

Since this is an uber-fallback case, I wonder if we should try that instead?

@aslushnikov points out that corp managed chrome's that have required chrome apps probably have very active extension threads. might mess this up. also agrees that "most active" is gross. :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an uber-fallback case, I wonder if we should try that instead?

Instead of instead, double check it with most events? :)

const firstResourceSendEvt = events.find(e => e.name === 'ResourceSendRequest');
// We know that these properties exist if we found the events, but TSC doesn't.
if (navStartEvt && navStartEvt.args && navStartEvt.args.data &&
firstResourceSendEvt && firstResourceSendEvt.tid === navStartEvt.tid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tid's for renderer are usually the same, so you gotta compare pids as well.

oh, assuming navstart is sent on the same pid? is it? ugh i love this shit. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, love is a..... word, haha lovehate? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. early on the approval.

we gotta check pids here.

@brendankenny
Copy link
Member

🤞 🤞 🤞

@brendankenny brendankenny merged commit a99ff82 into master Apr 29, 2019
@brendankenny brendankenny deleted the tracing_started_fix branch April 29, 2019 19:36
@paulirish paulirish mentioned this pull request Apr 29, 2019
@connorjclark connorjclark mentioned this pull request Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chrome Canary trace format has changed
3 participants