-
Notifications
You must be signed in to change notification settings - Fork 465
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
ThreadSafeFunction memory violation in ThreadSafeFinalize #632
Comments
KevinEady
added a commit
to KevinEady/node-addon-api
that referenced
this issue
Dec 16, 2019
Removes leftover cleanup in finalizer that was part of the original TSFN implementation. Fixes: nodejs#632
kevindavies8
added a commit
to kevindavies8/node-addon-api-Develop
that referenced
this issue
Aug 24, 2022
Removes leftover cleanup in finalizer that was part of the original TSFN implementation. Fixes: nodejs/node-addon-api#632 PR-URL: nodejs/node-addon-api#636 Reviewed-By: Gabriel Schulhof <[email protected]>
Marlyfleitas
added a commit
to Marlyfleitas/node-api-addon-Development
that referenced
this issue
Aug 26, 2022
Removes leftover cleanup in finalizer that was part of the original TSFN implementation. Fixes: nodejs/node-addon-api#632 PR-URL: nodejs/node-addon-api#636 Reviewed-By: Gabriel Schulhof <[email protected]>
wroy7860
added a commit
to wroy7860/addon-api-benchmark-node
that referenced
this issue
Sep 19, 2022
Removes leftover cleanup in finalizer that was part of the original TSFN implementation. Fixes: nodejs/node-addon-api#632 PR-URL: nodejs/node-addon-api#636 Reviewed-By: Gabriel Schulhof <[email protected]>
johnfrench3
pushed a commit
to johnfrench3/node-addon-api-git
that referenced
this issue
Aug 11, 2023
Removes leftover cleanup in finalizer that was part of the original TSFN implementation. Fixes: nodejs/node-addon-api#632 PR-URL: nodejs/node-addon-api#636 Reviewed-By: Gabriel Schulhof <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi everyone,
I've been experiencing random rare crashes in both Mac and Windows when Napi::ThreadSafeFunction is deallocated. My investigation brought me to the New function:
I believe that the issue is that
ThreadSafeFunction tsfn;
is stack-allocated and a pointer to its ivar is stored in the ThreadSafeFinalize:{ data, finalizeCallback, &tsfn._tsfn }
When function is being destroyed, the finalizer is called with this code in it:
If I understand correctly, it writes nullptr to the captured pointer, which is long gone by now.
Also, there are no other references in the code to that member. It feels like it's not used anywhere, and storing and nullifying it is redundant?
I also tested it with Xcode memory sanitizer and it confirmed that stack memory is being corrupted from ThreadSafeFinalize.
Thank you.
The text was updated successfully, but these errors were encountered: