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

Electron crash: async hook stack has become corrupted #85601

Closed
joaomoreno opened this issue Nov 26, 2019 · 10 comments
Closed

Electron crash: async hook stack has become corrupted #85601

joaomoreno opened this issue Nov 26, 2019 · 10 comments
Assignees
Labels
confirmed Issue has been confirmed by VS Code Team member electron Issues and items related to Electron freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues nodejs NodeJS support issues upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@joaomoreno
Copy link
Member

I stumbled upon this by chance, investigating #84425

KeybindingsRegistry.registerKeybindingRule({
	id: SetEditorLayoutAPICommand.ID,
	args: { orientation: 0, groups: [{ groups: [{}, {}], size: 0.5 }, { groups: [{}], size: 0.5 }] },
	weight: 999999,
	when: undefined,
	primary: KeyMod.CtrlCmd | KeyCode.KEY_P
});
  1. git checkout 47736a99f1c0ea7150e5774f37952bdc6e0fa5d4
  2. Open apiCommands.ts and append the snippet above at the end, and automatically add imports
  3. Run out of sources
  4. Press Ctrl/Cmd+P
  5. Close the editor to the right

Electron will just freeze after printing out the exception to the devtools. Error in terminal:

Error: async hook stack has become corrupted (actual: 6316, expected: 0)

Could it be related to #83994? cc @roblourens

@joaomoreno joaomoreno added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues electron Issues and items related to Electron labels Nov 26, 2019
@deepak1556
Copy link
Contributor

Thanks for the test case, I am able to repro the issue. This is a different one, async_hooks don't work with electron at the moment

Relevant discussions:
electron/electron#12109 (review)
electron/electron#18452
electron/electron#19466

You can workaround this temporarily by setting the following env variable export NODE_OPTIONS="--no-force-async-hooks-checks"

@deepak1556 deepak1556 added nodejs NodeJS support issues upstream-issue-linked This is an upstream issue that has been reported upstream confirmed Issue has been confirmed by VS Code Team member labels Nov 27, 2019
@MaxYari
Copy link

MaxYari commented Jan 15, 2020

@deepak1556 what does "workaround" means in that case? There must be a reason for this to be a hard error, I suspect muting it will just lead to some unexpected execution behaviours. If that's the case - that's not really a valid workaround by any means.

@DanTup
Copy link
Contributor

DanTup commented May 20, 2020

I don't know if this is useful (or even the same issue), but I got this same error message in a CI run on GitHub actions (seems like a flake, as only one bot failed with it):

Error: async hook stack has become corrupted (actual: 1391, expected: 0)

 1: 0x10e6d1ae4 node::InternalCallbackScope::Close() [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x10e6d1999 node::InternalCallbackScope::Close() [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

 3: 0x10e6d1da3 node::InternalCallbackScope::Close() [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

 4: 0x10e6d1fd1 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

 5: 0x10e7056a5 node::EmitAsyncDestroy(node::Environment*, node::async_context) [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x10e8403fd uv_check_stop [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

 7: 0x10e83ab59 uv_run [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

 8: 0x1091a5731 AtomInitializeICUandStartNode [/Users/runner/runners/2.262.1/work/Dart-Code/Dart-Code/.vscode-test/vscode-insiders/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]

https://github.com/Dart-Code/Dart-Code/runs/692332413#step:15:225

@debchy
Copy link

debchy commented Jul 15, 2020

in the main page of Electron, just add bellow environment variable. it will stop the cras.
process.env["NODE_OPTIONS"] = '--no-force-async-hooks-checks';

@yogithecoder
Copy link

I had the Same issue and my application screen went blank and white. Later i discovered it all happened because i was getting an element by id as file in html input which was actually a text. After i commented out that line , my application was working.
I think when the javascript hits any silly bug the electron app crashes and shows that error

@made-by-chris
Copy link

in the main page of Electron, just add bellow environment variable. it will stop the cras.
process.env["NODE_OPTIONS"] = '--no-force-async-hooks-checks';

This is currently not working for me in line 1 of main file

@made-by-chris
Copy link

in the main page of Electron, just add bellow environment variable. it will stop the cras.
process.env["NODE_OPTIONS"] = '--no-force-async-hooks-checks';

This is currently not working for me in line 1 of main file

It was related to an invalid file path for a tray icon:

main.tray = new Tray("/invalid/file/path.png");

The issue was fixed by fixing the file path. Shame the error didn't mention the underlying issue. without '--no-force-async-hooks-checks' and fixed path everything is fine.

@debchy
Copy link

debchy commented Aug 6, 2021

in the main page of Electron, just add bellow environment variable. it will stop the cras.
process.env["NODE_OPTIONS"] = '--no-force-async-hooks-checks';

This is currently not working for me in line 1 of main file

It was related to an invalid file path for a tray icon:

main.tray = new Tray("/invalid/file/path.png");

The issue was fixed by fixing the file path. Shame the error didn't mention the underlying issue. without '--no-force-async-hooks-checks' and fixed path everything is fine.

So, your issue is not related to "async hook stack".

@made-by-chris
Copy link

in the main page of Electron, just add bellow environment variable. it will stop the cras.
process.env["NODE_OPTIONS"] = '--no-force-async-hooks-checks';

This is currently not working for me in line 1 of main file

It was related to an invalid file path for a tray icon:

main.tray = new Tray("/invalid/file/path.png");

The issue was fixed by fixing the file path. Shame the error didn't mention the underlying issue. without '--no-force-async-hooks-checks' and fixed path everything is fine.

So, your issue is not related to "async hook stack".

i did receive the Error: async hook stack has become corrupted (actual: 1391, expected: 0) error, but im not an expert on why :D
I resolved the issue in the way i mentioned though.

@deepak1556
Copy link
Contributor

Closing since workbench no longer runs with Nodejs integration.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmed Issue has been confirmed by VS Code Team member electron Issues and items related to Electron freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues nodejs NodeJS support issues upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

7 participants