-
Notifications
You must be signed in to change notification settings - Fork 160
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
Re-implement subset of ThreadSafeCallback using thread safe function from napi #219
Re-implement subset of ThreadSafeCallback using thread safe function from napi #219
Conversation
When I run noble with electron, it segmentation faults on quit as issue #215 describe. If I run with this patch, ... ... the output looks like this:
So, it looks like memory region pointed by The crash occurs on OSX big sur, but not on catalina. I'm not sure why but possibly due to difference of implementation details between OSes. I guess it would be possible to modify original ThreadSafeCallback to delete node derived objects eariler, but at the same time we need to care so that threads won't touch deleted objects. Since node api provides same functionality as thread safe function nowadays, I hope such complicated works are done inside node api library. So I've created this PR and at least it works for me. |
Is there a related issue reported in NAPI ? |
Do you really mean napi rather than napi-thread-safe-callback? Anyway, I've just searched briefly in node or node-addon-api issues but I couldn't find something similar or related. |
It would make sense to try to suggest this feature upstream and see how it goes, then I'll merge this workaround patch |
Then, an upstream in this case is not napi but napi-thread-safe-callback npm. |
yes if you can comment elsewhere and link back here it can be helpful to community |
Here is a comment from author of napi-thread-safe-callback: mika-fischer/napi-thread-safe-callback#14 (comment) |
This PR implements subset of ThreadSafeCallback class, originally provided by napi-thread-safe-callback npm, on the top of thread safe function provided by node api, expecting to fix issue #215