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: allow napi_delete_reference in basic finalizers #55620

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

legendecas
Copy link
Member

napi_delete_reference must be called immediately for a
napi_reference returned from napi_wrap in the corresponding
finalizer, in order to clean up the napi_reference timely.

napi_delete_reference is safe to be invoked during GC.

`napi_delete_reference` must be called immediately for a
`napi_reference` returned from `napi_wrap` in the corresponding
finalizer, in order to clean up the `napi_reference` timely.

`napi_delete_reference` is safe to be invoked during GC.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp
  • @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 Oct 31, 2024
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.96%. Comparing base (7270f84) to head (551a7ae).
Report is 328 commits behind head on main.

Files with missing lines Patch % Lines
src/js_native_api_v8.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55620      +/-   ##
==========================================
- Coverage   88.43%   87.96%   -0.47%     
==========================================
  Files         654      656       +2     
  Lines      187666   188384     +718     
  Branches    36119    35968     -151     
==========================================
- Hits       165954   165716     -238     
- Misses      14954    15838     +884     
- Partials     6758     6830      +72     
Files with missing lines Coverage Δ
src/js_native_api_v8.cc 76.51% <0.00%> (ø)

... and 158 files with indirect coverage changes

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 Oct 31, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 31, 2024
@nodejs-github-bot
Copy link
Collaborator

@mhdawson
Copy link
Member

mhdawson commented Nov 1, 2024

@vmoroz will confirm that there is no issue in a Hermes implementation.

Main concern is around if deleting the reference and making an object collectable could cause some issues, for example if an engine uses reference counting and would try to collect the object immediately.

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.

Marking as request changes so we don't land until the check @vmoroz is going to do is complete

@mhdawson
Copy link
Member

mhdawson commented Dec 6, 2024

We discussed in the team meeting today and @vmoroz confirmed he looked at the Hermes code and its not a concern from the Hermes perspective.

@mhdawson mhdawson dismissed their stale review December 6, 2024 16:09

concern addressed

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 commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Dec 10, 2024
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 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

@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 13, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 13, 2024
@nodejs-github-bot nodejs-github-bot merged commit 6f084ff into nodejs:main Dec 13, 2024
63 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 6f084ff

@legendecas legendecas deleted the node-api/delete–reference branch December 13, 2024 15:54
targos pushed a commit that referenced this pull request Dec 13, 2024
`napi_delete_reference` must be called immediately for a
`napi_reference` returned from `napi_wrap` in the corresponding
finalizer, in order to clean up the `napi_reference` timely.

`napi_delete_reference` is safe to be invoked during GC.

PR-URL: #55620
Reviewed-By: Gabriel Schulhof <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Vladimir Morozov <[email protected]>
aduh95 pushed a commit that referenced this pull request Dec 18, 2024
`napi_delete_reference` must be called immediately for a
`napi_reference` returned from `napi_wrap` in the corresponding
finalizer, in order to clean up the `napi_reference` timely.

`napi_delete_reference` is safe to be invoked during GC.

PR-URL: #55620
Reviewed-By: Gabriel Schulhof <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Vladimir Morozov <[email protected]>
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++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. node-api Issues and PRs related to the Node-API.
Projects
Development

Successfully merging this pull request may close these issues.

6 participants