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

n-api: do not require JS Context for napi_async_destroy() #27255

Closed
wants to merge 4 commits into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Apr 16, 2019

src: add Environment overload of EmitAsyncDestroy

This can be necessary for being able to call the function when no
JS Context is on the stack, e.g. during GC.

(This is technically semver-minor.)

n-api: do not require JS Context for napi_async_destroy()

Allow the function to be called during GC, which is a common use case.

Fixes: #27218

/cc @nodejs/n-api

src: do not require JS Context for ~AsyncResoure()

Allow the destructor to be called during GC, which is a common use case.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

This can be necessary for being able to call the function when no
JS Context is on the stack, e.g. during GC.

Refs: nodejs#27218
@addaleax addaleax added semver-minor PRs that contain new features and should be released in the next minor version. node-api Issues and PRs related to the Node-API. lts-watch-v8.x labels Apr 16, 2019
@addaleax addaleax requested a review from bnoordhuis April 16, 2019 11:23
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Apr 16, 2019
Allow the function to be called during GC, which is a common use case.

Fixes: nodejs#27218
Allow the destructor to be called during GC,
which is a common use case.
@addaleax addaleax force-pushed the napi-async-destroy branch from 75cdfaf to 66f6944 Compare April 16, 2019 11:37
@addaleax addaleax changed the title n-api: do not requires JS Context for napi_async_destroy() n-api: do not require JS Context for napi_async_destroy() Apr 16, 2019
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 16, 2019
@addaleax
Copy link
Member Author

addaleax commented Apr 16, 2019

By the way, it sounds like there may not be any more v8.x semver-minor releases. (/cc @MylesBorins @nodejs/lts)

I do think that this, as a bug fix, should end up in a v10.x and v8.x release, respectively, according to the usual rules for bug fixes. However, the first commit here is technically semver-minor. So, that leaves a few options:

  1. Remove the semver-minor label. This makes this fit in well with our LTS workflow, is super-simple, but is also just plain wrong in terms of what the relevant commit does – it adds an API.
  2. Make the added function overload purely internal in backports. This is also easy, but seems to go against the best interests of our users, because they may need access to a function like that in the same way that we use the added function here internally. (It might be worth noting that this functionality isn’t all that widely used, likely.)
  3. Convince the LTS team to do another v8.x semver-minor release. I would expect that this is, unlike the other options, not an easy thing to do.

Any preferences?

@addaleax
Copy link
Member Author

Landed in #27255

@addaleax addaleax closed this Apr 24, 2019
@addaleax addaleax deleted the napi-async-destroy branch April 24, 2019 19:54
addaleax added a commit that referenced this pull request Apr 24, 2019
This can be necessary for being able to call the function when no
JS Context is on the stack, e.g. during GC.

Refs: #27218

PR-URL: #27255
Fixes: #27218
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
addaleax added a commit that referenced this pull request Apr 24, 2019
Allow the function to be called during GC, which is a common use case.

Fixes: #27218

PR-URL: #27255
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
addaleax added a commit that referenced this pull request Apr 24, 2019
Allow the destructor to be called during GC,
which is a common use case.

PR-URL: #27255
Fixes: #27218
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@mhdawson
Copy link
Member

From the options I think 2 or 3 is the right answer. I'm ok with 2 but it does seem odd to do extra work to hide the functionality just so that it can go into a semver minor release. That is unless there is more overall work in doing a release as semver minor versus semver patch. I do know that the 'extra' work might be to discuss what other semver minors might also go in but if we could just agree that the next release would be be semver minor with this one minor plus the other 'patches' then it might not be any additional work.

targos pushed a commit that referenced this pull request Apr 27, 2019
This can be necessary for being able to call the function when no
JS Context is on the stack, e.g. during GC.

Refs: #27218

PR-URL: #27255
Fixes: #27218
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
targos pushed a commit that referenced this pull request Apr 27, 2019
Allow the function to be called during GC, which is a common use case.

Fixes: #27218

PR-URL: #27255
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
targos pushed a commit that referenced this pull request Apr 27, 2019
Allow the destructor to be called during GC,
which is a common use case.

PR-URL: #27255
Fixes: #27218
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
targos added a commit that referenced this pull request Apr 27, 2019
Notable changes:

* intl:
  * Update ICU to 64.2. This adds support for Japanese Era (Reiwa).
    #27361
  * Fixes a bug in ICU that affected Node.js 12.0.0 in the case where
    `new Date().toLocaleString()` was called with a non-default locale.
    #27415
* C++ API:
  * Added an `Environment` overload of `EmitAsyncDestroy`.
    #27255

PR-URL: TODO
@targos targos mentioned this pull request Apr 27, 2019
targos added a commit that referenced this pull request Apr 29, 2019
Notable changes:

* intl:
  * Update ICU to 64.2. This adds support for Japanese Era (Reiwa).
    #27361
  * Fixes a bug in ICU that affected Node.js 12.0.0 in the case where
    `new Date().toLocaleString()` was called with a non-default locale.
    #27415
* C++ API:
  * Added an overload of `EmitAsyncDestroy` that can be used during
    garbage collection.
    #27255

PR-URL: #27440
targos added a commit that referenced this pull request Apr 29, 2019
Notable changes:

* intl:
  * Update ICU to 64.2. This adds support for Japanese Era (Reiwa).
    #27361
  * Fixes a bug in ICU that affected Node.js 12.0.0 in the case where
    `new Date().toLocaleString()` was called with a non-default locale.
    #27415
* C++ API:
  * Added an overload of `EmitAsyncDestroy` that can be used during
    garbage collection.
    #27255

PR-URL: #27440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. node-api Issues and PRs related to the Node-API. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EXC_BAD_ACCESS: Environment::GetCurrent returns nullptr in node::EmitAsyncDestroy
6 participants