FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: distinguish env stopping flags by legendecas · Pull Request #45907 · nodejs/node · GitHub

/ node Public

src: distinguish env stopping flags - #45907

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
legendecas:env-is-stopping
Jan 14, 2023
Merged

src: distinguish env stopping flags#45907
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
legendecas:env-is-stopping

Conversation

legendecas commented Dec 19, 2022
edited
Loading

Copy link
Copy Markdown
Member

Currently, !env->can_call_into_js() and env->is_stopping() have different semantics by their names. The is_stopping() flag implies !env->can_call_into_js().

However, this implication is not enforced in Environment::FreeEnvironment. Environment::FreeEnvironment creates a DisallowJavascriptExecutionScope, the flag Environment::can_call_into_js() needs to be set as false.

As Environment::can_call_into_js_ is a simple boolean flag, it should not be accessed off-thread. This also fixes an issue that the flag Environment::can_call_into_js_ is been modified in Environment::ExitEnv, which may be called from other threads.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/modules
  • @nodejs/net
  • @nodejs/vm

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Dec 19, 2022
Comment thread src/api/environment.cc Outdated
Comment thread src/env.h Outdated
Comment thread src/module_wrap.cc Outdated
Comment thread src/node_contextify.cc Outdated
Comment thread src/env-inl.h Outdated
legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 5, 2023

Copy link
Copy Markdown
Collaborator

`Environment::FreeEnvironment` creates a
`DisallowJavascriptExecutionScope`, so the flag
`Environment::can_call_into_js()` should also be set as `false`. As
`Environment::can_call_into_js_` is a simple boolean flag, it should not
be accessed off-threads.
legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 8, 2023
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 8, 2023

Copy link
Copy Markdown
Collaborator

mcollina left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I've spent a bit of time trying to figure out those lines of code.

I'd be more comfortable with an added test for this change, but I agree it might be very hard to check.

Copy link
Copy Markdown
Collaborator

mcollina added commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Jan 14, 2023
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 14, 2023
nodejs-github-bot merged commit bb40507 into nodejs:main Jan 14, 2023

Copy link
Copy Markdown
Collaborator

Landed in bb40507

RafaelGSS pushed a commit to RafaelGSS/node that referenced this pull request Jan 17, 2023
`Environment::FreeEnvironment` creates a
`DisallowJavascriptExecutionScope`, so the flag
`Environment::can_call_into_js()` should also be set as `false`. As
`Environment::can_call_into_js_` is a simple boolean flag, it should not
be accessed off-threads.

PR-URL: nodejs#45907
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Jan 20, 2023
`Environment::FreeEnvironment` creates a
`DisallowJavascriptExecutionScope`, so the flag
`Environment::can_call_into_js()` should also be set as `false`. As
`Environment::can_call_into_js_` is a simple boolean flag, it should not
be accessed off-threads.

PR-URL: #45907
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
RafaelGSS mentioned this pull request Jan 20, 2023
juanarbol pushed a commit that referenced this pull request Jan 26, 2023
`Environment::FreeEnvironment` creates a
`DisallowJavascriptExecutionScope`, so the flag
`Environment::can_call_into_js()` should also be set as `false`. As
`Environment::can_call_into_js_` is a simple boolean flag, it should not
be accessed off-threads.

PR-URL: #45907
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
juanarbol mentioned this pull request Jan 28, 2023
juanarbol pushed a commit that referenced this pull request Jan 31, 2023
`Environment::FreeEnvironment` creates a
`DisallowJavascriptExecutionScope`, so the flag
`Environment::can_call_into_js()` should also be set as `false`. As
`Environment::can_call_into_js_` is a simple boolean flag, it should not
be accessed off-threads.

PR-URL: #45907
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
bcoe mentioned this pull request Dec 18, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL