-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
node::IsolateData allocates V8 objects before initializing platform #20171
Comments
I think that’s fine, yes. |
Allocation of strings may cause a garbage collection that uses the platform to post tasks. PR-URL: #20175 Fixes: #20171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Allocation of strings may cause a garbage collection that uses the platform to post tasks. PR-URL: #20175 Fixes: #20171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Allocation of strings may cause a garbage collection that uses the platform to post tasks. PR-URL: #20175 Fixes: #20171 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
I'm encountering the exact error above in a node script I'm running. I'm using node 10.13.0, which was released after this fix seems to have been committed. Was this change included in 10.13.0? But if I run Other searches for the same error yielded only people finding bugs on ARM architectures, but I'm on a recent Macbook. Am I barking up the wrong tree here?
|
Looks like it was added to 10.1.0, if I'm reading this page correctly. So I guess there's more than one way to cause this problem. I realize this is not a support forum, but any tips would be welcome! |
@nathancarter the assertion looks similar, but the root cause might be different. Your stack trace suggests that node is already running some script (lines 18-21 looks like generated code). In my case the crash happened during node initialization before running the scripts. I'd suggest opening a new issue with steps to reproduce. |
OK. I'll do that as soon as I can get to a minimal working example. Current example is huge. Thanks! |
The constructor of
node::IsolateData
allocates strings in V8 heap before registering itself with the platform. This is not safe because an allocation can trigger GC, which relies on the platform to post tasks.The problem reproduces with
--stress-incremental-marking
flag.A fix would be to move the allocating code after
platform_->RegisterIsolate(this, event_loop);
If that sounds good, I will create a PR.
The text was updated successfully, but these errors were encountered: