Skip to content

src: avoid using v8 on Isolate termination - #44669

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
santigimeno:santi/fix_debug_build
Sep 21, 2022
Merged

nodejs-github-bot merged 2 commits into
nodejs:mainfrom
santigimeno:santi/fix_debug_build

Conversation

@santigimeno

Copy link
Copy Markdown
Member

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 16, 2022
Comment thread src/env.cc Outdated

ghost Sep 16, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (isolate_->IsExecutionTerminating())
if (is_stopping())

?

ghost Sep 19, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I already tried that approach but it made a number of tests not to exit because, I think, they need that some immediates that don't call into JS to run before exiting (also, apparently calling TerminateExecution() doesn't make an immediate call to IsExecutionTerminating() to return true, it may take a while before it does).

ghost Sep 19, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well yeah, looking at this code, it seems like this isn’t the right place to just return; without calling the remaining callbacks. Some of them perform cleanup operations that shouldn’t be skipped, it’s rather up to the callbacks to ensure that they don’t call into JS.

Comment thread src/env-inl.h Outdated

ghost Sep 16, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you leave a comment here about why this is necessary? I’d definitely like to avoid a change like this, esp. considering that this method should never attempt to call into JS anyway, so if it’s about signaling something specific to callers then it’s probably worth thinking about whether there’s another way of doing this. (If it’s about the HandleScope then I’d suggest to conditionally omit that scope, but that seems like it would cause trouble for us in other places as well.)

ghost Sep 19, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it was because of the HandleScope and I agree this is not the place to make this change. I'm trying another approach in the next patch.

@santigimeno

ghost commented Sep 19, 2022

Copy link
Copy Markdown
Member Author

@addaleax I updated the code. Could you PTAL? Thanks!

@targos

ghost commented Sep 20, 2022

Copy link
Copy Markdown
Member

Is this something that we can land on main after verifying that it fixes canary or do we have to wait?

@nodejs-github-bot

ghost commented Sep 20, 2022

Copy link
Copy Markdown
Collaborator

@targos

ghost commented Sep 20, 2022

Copy link
Copy Markdown
Member

Debug build is green 🎉

https://ci.nodejs.org/job/node-test-commit-arm-debug/4084/

@santigimeno

ghost commented Sep 20, 2022

Copy link
Copy Markdown
Member Author

Is this something that we can land on main after verifying that it fixes canary or do we have to wait?

I don't think there's a reason this can't land on main first.

@targos

ghost commented Sep 20, 2022

Copy link
Copy Markdown
Member

Ok, then would you like to retarget this to main (or open another PR if that's easier)?

@santigimeno
santigimeno changed the base branch from canary-base to main September 20, 2022 18:44
Fix multiple instances of those uncovered while running the tests on
debug builds.

Fixes: nodejs/node-v8#227
@santigimeno

ghost commented Sep 20, 2022

Copy link
Copy Markdown
Member Author

@targos done

@targos

ghost commented Sep 21, 2022

Copy link
Copy Markdown
Member

@nodejs/cpp-reviewers

@nodejs-github-bot

ghost commented Sep 21, 2022

Copy link
Copy Markdown
Collaborator

@RaisinTen RaisinTen added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 21, 2022
@targos targos added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Sep 21, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 21, 2022
@nodejs-github-bot
nodejs-github-bot merged commit d2cf01d into nodejs:main Sep 21, 2022
@nodejs-github-bot

ghost commented Sep 21, 2022

Copy link
Copy Markdown
Collaborator

Landed in d2cf01d

@santigimeno
santigimeno deleted the santi/fix_debug_build branch September 21, 2022 13:47
@hybrist

ghost commented Jun 26, 2023

Copy link
Copy Markdown
Contributor

I think this may be causing access to uninitialized memory because this code may run during construction of Environment but before the atomics have been initialized? Sending #48566.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash PRs the Commit Queue should land as one squashed commit. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DCHECK crash on !i_isolate->is_execution_terminating()

7 participants