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

fix: issue #355 #356

Merged
merged 2 commits into from Feb 5, 2021
Merged

fix: issue #355 #356

merged 2 commits into from Feb 5, 2021

Conversation

pipobscure
Copy link
Contributor

@pipobscure pipobscure commented Feb 4, 2021

The napi_external that maintains the watch on a file is closured into the stop function returned by fsevents.watch.
When that napi_external is garbage collected, the callback that was passed in is released and becomes uncallable. When it is called depsite this, the napi_env that is passed in is NULL which is intended by N-API as a signal that the function is no longer usable.

I ignored it in the past, because I always retain the stop function. However a test-script like the one provided provokes this. When garbage collection happens, the napi_external is cleared. However there may still be events in the pipeline. And that in turn triggers the crash in #355 .

I am now handling the napi_env as NULL signal properly by just dropping the event. In consequence, if you do not retain the stop function event reporting simply stops. And this will happen fairly quickly.

fixes #355

@pipobscure
Copy link
Contributor Author

Just waiting for CI. Then merge and release.

@impowski
Copy link

impowski commented Feb 5, 2021

Waiting for this one 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

napi_create_string_utf8 assertion failed
2 participants