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: suppress protocol timeout for app manifest bug in LR #7184

Merged
merged 4 commits into from
Feb 8, 2019

Conversation

connorjclark
Copy link
Collaborator

Fixes #7147

See b/124008171.

@connorjclark connorjclark changed the title core: do not cause protocol timeout for app manifest bug in LR core: suppress protocol timeout for app manifest bug in LR Feb 7, 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.

Seems fine for a hotfix :)

I assume there's a plan on the LR side to actually fix this? :) Presumably anyone falling into this set of circumstances won't be able to be a PWA according to LH

const response = await passContext.driver.getAppManifest();
if (response) return manifestParser(response.data, response.url, passContext.url);
} catch (err) {
// LR will timeout fetching the app manifest in some cases
Copy link
Member

@brendankenny brendankenny Feb 7, 2019

Choose a reason for hiding this comment

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

LR will timeout fetching the app manifest in some cases

maybe just add ", move on without one." to this line, delete the lines after this, and link to the full https://github.com/GoogleChrome/lighthouse/issues/7147 (even better if there's a definitive summary comment to link to)

// see #7147 or b/124008171
// instead of failing completely by throwing a protocol timeout error,
// just pretend there is no app manifest.
log.error('Failed fetching manifest', err);
Copy link
Member

Choose a reason for hiding this comment

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

need a log.error('GatherRunner', 'Failed fetching...', err);

return manifestParser(response.data, response.url, passContext.url);
try {
const response = await passContext.driver.getAppManifest();
if (response) return manifestParser(response.data, response.url, passContext.url);
Copy link
Member

Choose a reason for hiding this comment

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

this should move below the catch so we aren't accidentally hiding errors in the parser

// instead of failing completely by throwing a protocol timeout error,
// just pretend there is no app manifest.
log.error('Failed fetching manifest', err);
}
Copy link
Member

Choose a reason for hiding this comment

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

should the catch only apply for a err.code === 'PROTOCOL_TIMEOUT', otherwise rethrow?

@brendankenny
Copy link
Member

FWIW I feel like the real fix (in a follow up) is a way to express manifest fetching errors in the WebAppManifest artifact so that audits that depend on it can expose that (and not say something like "you don't have a manifest" which may or may not be true).

There's already a way to say "this was invalid JSON"; adding information about the network fetch doesn't seem like it would be too bad.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

WDYT about just catching this in driver's getAppManifest instead? I think several of @brendankenny's comments would be non-factors if we did that

@brendankenny
Copy link
Member

Presumably anyone falling into this set of circumstances won't be able to be a PWA according to LH

I guess that's a little silly to worry about because we don't expose the PWA section yet in PSI, so we have a bit of time there :)

@brendankenny
Copy link
Member

WDYT about just catching this in driver's getAppManifest instead?

what should it return, though? Ideally you'd get a "timed out waiting for the manifest" explanation in the report, and not just "you didn't have a manifest".

@connorjclark
Copy link
Collaborator Author

what should it return, though? Ideally you'd get a "timed out waiting for the manifest" explanation in the report, and not just "you didn't have a manifest".

Yeah that would be better, but I think we want to deploy something soon. Some big sites like toyota.com are failing completely (and ~1% of urls). Are we okay with this hotfix for the LR fix, and following up with a more thorough workaround later? The root cause of this bug likely won't be fixed until late next week.

@brendankenny
Copy link
Member

Yeah that would be better, but I think we want to deploy something soon...Are we okay with this hotfix for the LR fix, and following up with a more thorough workaround later?

sorry, yes, I definitely agree with that. I guess just anticipating the follow up discussion :)

if (err.code === 'PROTOCOL_TIMEOUT') {
// LR will timeout fetching the app manifest in some cases, move on without one.
// https://github.com/GoogleChrome/lighthouse/issues/7147#issuecomment-461210921
log.error('Driver', 'Failed fetching...', err);
Copy link
Member

@brendankenny brendankenny Feb 7, 2019

Choose a reason for hiding this comment

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

ha, sorry, I meant "..." for the rest of the message you had before, I just didn't want to retype it :)

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.

can you file an issue to either include manifest fetch failure as part of the WebAppManifest artifact or to remove this this workaround once the downstream issue is fixed?

Beyond that, LGTM!

@paulirish paulirish merged commit 5c0483c into master Feb 8, 2019
@paulirish paulirish deleted the ignore-app-manifest-timeout branch February 8, 2019 00:25
@brendankenny
Copy link
Member

ha, I was just going to add that codecov brings up a good point about needing a test or two. We have good existing coverage and the jest.advanceTimersByTime is ready made for testing timeouts, so it shouldn't be much work

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.

4 participants