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

node-api: make tsfn accept napi_finalize once more #51801

Merged

Conversation

gabrielschulhof
Copy link
Contributor

The thread-safe function's finalizer is not called in conjunction with the garbage collection of a JS value. In fact, it keeps a strong reference to the JS function it is expected to call. Thus, it is safe to make calls that affect GC state from its body.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/node-api

@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. node-api Issues and PRs related to the Node-API. labels Feb 18, 2024
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

@mhdawson mhdawson added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 20, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@gabrielschulhof gabrielschulhof force-pushed the tsfn-undo-nogc-finalizer branch from 6957cd6 to b098fc1 Compare February 21, 2024 09:48
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

The thread-safe function's finalizer is not called in conjunction with
the garbage collection of a JS value. In fact, it keeps a strong
reference to the JS function it is expected to call. Thus, it is safe
to make calls that affect GC state from its body.
@gabrielschulhof gabrielschulhof force-pushed the tsfn-undo-nogc-finalizer branch from b098fc1 to 9a9266c Compare March 1, 2024 05:45
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@gabrielschulhof gabrielschulhof 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 Mar 8, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 8, 2024
@nodejs-github-bot nodejs-github-bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Mar 8, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/51801
✔  Done loading data for nodejs/node/pull/51801
----------------------------------- PR info ------------------------------------
Title      node-api: make tsfn accept napi_finalize once more (#51801)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     gabrielschulhof:tsfn-undo-nogc-finalizer -> nodejs:main
Labels     c++, node-api
Commits    1
 - node-api: make tsfn accept napi_finalize once more
Committers 1
 - Gabriel Schulhof 
PR-URL: https://github.com/nodejs/node/pull/51801
Reviewed-By: Michael Dawson 
Reviewed-By: Chengzhong Wu 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/51801
Reviewed-By: Michael Dawson 
Reviewed-By: Chengzhong Wu 
--------------------------------------------------------------------------------
   ⚠  Commits were pushed since the last approving review:
   ⚠  - node-api: make tsfn accept napi_finalize once more
   ℹ  This PR was created on Sun, 18 Feb 2024 17:08:52 GMT
   ✔  Approvals: 2
   ✔  - Michael Dawson (@mhdawson) (TSC): https://github.com/nodejs/node/pull/51801#pullrequestreview-1890738462
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/51801#pullrequestreview-1894793505
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-03-08T05:35:24Z: https://ci.nodejs.org/job/node-test-pull-request/57629/
- Querying data for job/node-test-pull-request/57629/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/8206250115

@gabrielschulhof
Copy link
Contributor Author

@legendecas, @mhdawson can you please give the PR another look?

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.

Still LGTM

@gabrielschulhof gabrielschulhof added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Mar 9, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 9, 2024
@nodejs-github-bot nodejs-github-bot merged commit f0e6acd into nodejs:main Mar 9, 2024
58 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in f0e6acd

@mhdawson mhdawson added lts-watch-v18.x PRs that may need to be released in v18.x. lts-watch-v20.x PRs that may need to be released in v20.x labels Mar 15, 2024
rdw-msft pushed a commit to rdw-msft/node that referenced this pull request Mar 26, 2024
The thread-safe function's finalizer is not called in conjunction with
the garbage collection of a JS value. In fact, it keeps a strong
reference to the JS function it is expected to call. Thus, it is safe
to make calls that affect GC state from its body.

PR-URL: nodejs#51801
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
marco-ippolito pushed a commit that referenced this pull request May 2, 2024
The thread-safe function's finalizer is not called in conjunction with
the garbage collection of a JS value. In fact, it keeps a strong
reference to the JS function it is expected to call. Thus, it is safe
to make calls that affect GC state from its body.

PR-URL: #51801
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
richardlau pushed a commit that referenced this pull request May 7, 2024
The thread-safe function's finalizer is not called in conjunction with
the garbage collection of a JS value. In fact, it keeps a strong
reference to the JS function it is expected to call. Thus, it is safe
to make calls that affect GC state from its body.

PR-URL: #51801
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
jcbhmr pushed a commit to jcbhmr/node that referenced this pull request May 15, 2024
The thread-safe function's finalizer is not called in conjunction with
the garbage collection of a JS value. In fact, it keeps a strong
reference to the JS function it is expected to call. Thus, it is safe
to make calls that affect GC state from its body.

PR-URL: nodejs#51801
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
@richardlau richardlau added backported-to-v18.x PRs backported to the v18.x-staging branch. backported-to-v20.x PRs backported to the v20.x-staging branch. and removed lts-watch-v18.x PRs that may need to be released in v18.x. lts-watch-v20.x PRs that may need to be released in v20.x labels May 16, 2024
@richardlau richardlau mentioned this pull request May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported-to-v18.x PRs backported to the v18.x-staging branch. backported-to-v20.x PRs backported to the v20.x-staging branch. c++ Issues and PRs that require attention from people who are familiar with C++. node-api Issues and PRs related to the Node-API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants