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

src: simplify Environment::HandleCleanup #19319

Closed
wants to merge 2 commits into from

Conversation

joyeecheung
Copy link
Member

src: call CleanupHandles in FreeEnvironment

CleanupHandles() has not been called in our own code base anymore
after the v8 debug agent has been removed. It used to be in the
~Environment() destructor but then removed to avoid firing other
events after the exit event, given that we were not going to
clean up handles for the one environment per process setup.
Call it in FreeEnvironment so that embedders can clean up
the handles in the loop when creating multiple environments.

src: simplify Environment::HandleCleanup

  • Make the HandleCleanup a struct, and make the queue a
    std::list, iterate over it in CleanupHandles() and clear
    it after that.
  • Put the handle cleanup registration into a method and
    document that they will not be called in the one environemt
    per process setup.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

CleanupHandles() has not been called in our own code base anymore
after the v8 debug agent has been removed. It used to be in the
~Environment() destructor but then removed to avoid firing other
events after the exit event, given that we were not going to
clean up handles for the one environment per process setup.
Call it in FreeEnvironment so that embedders can clean up
the handles in the loop when creating multiple environments.
- Make the HandleCleanup a struct, and make the queue a
  std::list, iterate over it in CleanupHandles() and clear
  it after that.
- Put the handle cleanup registration into a method and
  document that they will not be called in the one environemt
  per process setup.
@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Mar 13, 2018
@joyeecheung joyeecheung changed the title Simplify cleanup src: simplify Environment::HandleCleanup Mar 13, 2018
@joyeecheung
Copy link
Member Author

@joyeecheung
Copy link
Member Author

cc @addaleax @bnoordhuis

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Thank you!

@joyeecheung joyeecheung added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 14, 2018
@addaleax
Copy link
Member

Landed in 855dabd, a1a409a 🎉

@addaleax addaleax closed this Mar 15, 2018
@addaleax addaleax added lib / src Issues and PRs related to general changes in the lib or src directory. embedding Issues and PRs related to embedding Node.js in another project. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Mar 15, 2018
addaleax pushed a commit that referenced this pull request Mar 15, 2018
CleanupHandles() has not been called in our own code base anymore
after the v8 debug agent has been removed. It used to be in the
~Environment() destructor but then removed to avoid firing other
events after the exit event, given that we were not going to
clean up handles for the one environment per process setup.
Call it in FreeEnvironment so that embedders can clean up
the handles in the loop when creating multiple environments.

PR-URL: #19319
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
addaleax pushed a commit that referenced this pull request Mar 15, 2018
- Make the HandleCleanup a struct, and make the queue a
  std::list, iterate over it in CleanupHandles() and clear
  it after that.
- Put the handle cleanup registration into a method and
  document that they will not be called in the one environemt
  per process setup.

PR-URL: #19319
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

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++. embedding Issues and PRs related to embedding Node.js in another project. 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.

7 participants