-
Notifications
You must be signed in to change notification settings - Fork 30k
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
The head ref may contain hidden characters: "node-api/delete\u2013reference"
node-api: allow napi_delete_reference in basic finalizers #55620
Conversation
`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.
Review requested:
|
Codecov ReportAttention: Patch coverage is
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@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. |
There was a problem hiding this 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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Landed in 6f084ff |
`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 <gabrielschulhof@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
`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 <gabrielschulhof@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com>
napi_delete_reference
must be called immediately for anapi_reference
returned fromnapi_wrap
in the correspondingfinalizer, in order to clean up the
napi_reference
timely.napi_delete_reference
is safe to be invoked during GC.