Skip to content

Conversation

@zcbenz
Copy link
Contributor

@zcbenz zcbenz commented May 25, 2019

Description of Change

Close #12798.

Due to the way node integration works in Electron, the async hooks can not correctly track the execution of async calls under certain cases. We should eventually find out how to make async hooks work correctly in Electron, but for now we just disable the check to avoid hard crashes.

The async hooks will not be able to track those executions which crashed before, but there are no other side effects.

Checklist

Release Notes

Notes: Fix crash when throwing Error in setImmediate

@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "6-0-x", please check out #18453

@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "5-0-x", please check out #18454

1 similar comment
@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "5-0-x", please check out #18454

@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "4-2-x", please check out #18455

1 similar comment
@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "4-2-x", please check out #18455

@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "3-1-x", please check out #18456

1 similar comment
@trop
Copy link
Contributor

trop bot commented May 25, 2019

A maintainer has manually backported this PR to "3-1-x", please check out #18456

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label May 26, 2019
Copy link
Contributor

@nornagon nornagon left a comment

Choose a reason for hiding this comment

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

What are the consequences of the failing check? Should we disable async hooks altogether if they don't work correctly?

it('does not crash', () => {
const asyncHooks = require('async_hooks')
const hook = asyncHooks.createHook({ init: function () {} })
hook.enable()
Copy link
Contributor

Choose a reason for hiding this comment

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

can we disable this after the test is done?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the PR, will update the back ports after this gets merged.

@zcbenz
Copy link
Contributor Author

zcbenz commented May 29, 2019

What are the consequences of the failing check? Should we disable async hooks altogether if they don't work correctly?

The failing checks does not affect runtime code, the async IDs are just numbers provided to track executions of async calls. In the worst case, users using async_hook module to track executions will receive wrong async IDs.

Node started to enable the check by default from Node 10 (nodejs/node#16318), this PR essentially reverts the change and make Electron's behavior aligned with Electron 2.0, so it shouldn't make things worse.

Disabling async hooks altogether sounds good to me, but I'm not sure what's the best way, should require('async_hook') throw exception? or should it throw exception when create is called? or should the hooks fail silently? or should we just print a warning in console and let users decide whether to use it?

It is probably a change that should be separated from this PR.

@zcbenz zcbenz force-pushed the uv-run-once-corruption branch from cdc4ea0 to 3090d89 Compare May 29, 2019 01:33
@codebytere codebytere requested a review from nornagon May 31, 2019 04:20
@nornagon
Copy link
Contributor

nornagon commented Jul 2, 2019

I'm concerned that just failing to crash in this situation will cause more subtle and hard-to-detect failures later on as the async hook stack gets corrupted.

I think we need a real fix for this, I'm not convinced that merging this will truly improve the situation.

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.

Unhandled errors in renderer in node context terminate the renderer

3 participants