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 issues with next tick never running #549

Merged
merged 2 commits into from
May 7, 2017

Conversation

dpolivy
Copy link
Contributor

@dpolivy dpolivy commented May 5, 2017

Possible fix for #325

Calling v8::Function::Call directly for async callbacks leads to very
odd behavior in some circumstances, specifically the next tick of the
event loop seems to get stuck. After much digging, I found references to
this being a "known" issue, and the proper way to call async functions
in JS is to use the node::MakeCallback helper, or the Nan equivalent. In
some cases, we also use the Nan::Callback object as a helper for
managing JS callbacks.

KNOWN ISSUES: On node <v6, it seems that exceptions thrown from JS when
called from .NET do NOT propagate back to .NET correctly. Instead, they
terminate the JS process. This appears to be a known limitation of using
the MakeCallback method, with no easy workarounds. On 6.4.0, this test
does pass, which indicates the issue has been fixed in node.
The previous fixes to use Nan::MakeCallback had the side effect of
swallowing exceptions on Node <v6, which was a regression. To retain
that behavior, we revert the JS execution calls to using Nan::Call
instead of Nan::MakeCallback, and instead explicitly kick the next tick
with a no-op function.
@tjanczuk tjanczuk merged commit 83d9507 into tjanczuk:master May 7, 2017
@dpolivy dpolivy deleted the fix-async-issues branch May 8, 2017 15:22
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.

2 participants