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

fix: renderer crash on setImmediate #26365

Merged
merged 4 commits into from Nov 10, 2020
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Nov 6, 2020

Description of Change

Closes #26055.

Fixes an issue whereby a corrupted async_hooks stack would crash the renderer when throwing some errors in the renderer process. This happened because Node.js resets the async hook stack when exceptions are thrown inside their uncaught exception handler, and in the renderer process we were using Blink's which did not do this. This is fixed by adding our own uncaught message listener to the renderer isolate - this resets the async hook stack to mitigate the crash and better align with Node.js' behavior. Isolate message listeners are additive (you can add multiple) so this does not interfere with Blink's own handling.

cc @ckerr @MarshallOfSound

Checklist

Release Notes

Notes: Fixes an issue whereby a corrupted async_hooks stack would crash the renderer when throwing some errors in the renderer process.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Nov 6, 2020
@codebytere codebytere force-pushed the fix-async-hooks-exception-crash branch from 7a64f7a to f02538c Compare November 6, 2020 18:13
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Nov 7, 2020
Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

I know we talked about this on Slack, but I think crash-cases won't work for us here. crash-cases detect if the main process crashes, because this crash is in the renderer we'll need a different system 🤔

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

nvm I see what you're doing now 👍

…ex.js

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
@codebytere codebytere merged commit e6db496 into master Nov 10, 2020
@release-clerk
Copy link

release-clerk bot commented Nov 10, 2020

Release Notes Persisted

Fixes an issue whereby a corrupted async_hooks stack would crash the renderer when throwing some errors in the renderer process.

@codebytere codebytere deleted the fix-async-hooks-exception-crash branch November 10, 2020 17:18
@trop
Copy link
Contributor

trop bot commented Nov 10, 2020

I was unable to backport this PR to "10-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot removed the target/10-x-y label Nov 10, 2020
@trop
Copy link
Contributor

trop bot commented Nov 10, 2020

I was unable to backport this PR to "9-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Nov 10, 2020

I have automatically backported this PR to "11-x-y", please check out #26424

@trop
Copy link
Contributor

trop bot commented Dec 1, 2020

@codebytere has manually backported this PR to "10-x-y", please check out #26747

@trop
Copy link
Contributor

trop bot commented Dec 1, 2020

@codebytere has manually backported this PR to "9-x-y", please check out #26748

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.

setImmediate crash
5 participants