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(fetcher): ensure fetch doesn't cause unhandled promise #11036

Merged
merged 6 commits into from
Jul 7, 2020

Conversation

connorjclark
Copy link
Collaborator

Fixes #11033

@connorjclark connorjclark requested a review from a team as a code owner June 29, 2020 19:44
@connorjclark connorjclark requested review from patrickhulce and removed request for a team June 29, 2020 19:44

this.driver.evaluateAsync(`${injectIframe}(${JSON.stringify(url)})`, {
useIsolation: true,
}).catch(err => console.error(err));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should we bother logging this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just put it into a Promise.all([racePromise, injectPromise]) to get into the normal control flow?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't see how. Send PR?

@connorjclark
Copy link
Collaborator Author

#11033 doesn't effect canary chrome or LR*. We should follow up with a 6.1.1 release just for npm.

@patrickhulce and I don't know why Node 12 crashes on this error :o
image (2)

* still need to confirm. @mikedijkstra can you provide some more URLs where this crash occurs?

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.

also need to add reject on errors on the two .sendCommand that are dangling atm

a test would be nice for this, though I'm not entirely sure how to add one 🤔

maybe our super ancient sentry client is doing the exiting instead of node? we can probably just disable that and/or upgrade it


this.driver.evaluateAsync(`${injectIframe}(${JSON.stringify(url)})`, {
useIsolation: true,
}).catch(err => console.error(err));
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just put it into a Promise.all([racePromise, injectPromise]) to get into the normal control flow?

@patrickhulce
Copy link
Collaborator

yeah I don't know why it's exiting #11033 hasn't landed yet...

@connorjclark connorjclark changed the title core(fetcher): ensure fetchResource will not result in unhandled promise rejection core(fetcher): ensure fetchResource doesn't result in unhandled promise rejection Jun 29, 2020
@connorjclark connorjclark changed the title core(fetcher): ensure fetchResource doesn't result in unhandled promise rejection core(fetcher): ensure fetch doesn't result in unhandled promise rejection Jun 29, 2020
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.

fix for the dangling sendCommand too? I can't suggest on those, but basically in lines 110 and 131

this.driver.sendCommand(...).catch(reject)

lighthouse-core/gather/fetcher.js Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview June 30, 2020 23:59 Inactive
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.

this LGTM, but I still think we should fix the sendCommand leaks too.

can either merge and rebase #11044 against master, or merge #11044 into here :)

@connorjclark connorjclark changed the title core(fetcher): ensure fetch doesn't result in unhandled promise rejection core(fetcher): ensure fetch doesn't cause unhandled promise Jul 7, 2020
@connorjclark connorjclark merged commit 1101b5e into master Jul 7, 2020
@connorjclark connorjclark deleted the fixfetcher branch July 7, 2020 16:41
connorjclark added a commit that referenced this pull request Jul 7, 2020
connorjclark added a commit that referenced this pull request Jul 7, 2020
@connorjclark connorjclark mentioned this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhandled promise rejection (lighthouse-core/gather/fetcher.js)
4 participants