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

Nan 2.10.0 causing errors #755

Open
xzyfer opened this issue Mar 17, 2018 · 8 comments
Open

Nan 2.10.0 causing errors #755

xzyfer opened this issue Mar 17, 2018 · 8 comments

Comments

@xzyfer
Copy link

xzyfer commented Mar 17, 2018

It appears the native addon Node Sass compiled for Node 9 with Nan 2.10.0 are resulting in errors.

i.e.

[1]    9331 illegal hardware instruction  npm test

There is more detailed information in sass/node-sass#2293

This may be related the the MakeCallback deprecation. We're happy to address the deprecation within Node Sass, but the I suspect these failure were unexpected.

xzyfer added a commit to xzyfer/node-sass that referenced this issue Mar 17, 2018
xzyfer added a commit to sass/node-sass that referenced this issue Mar 17, 2018
@kkoopa
Copy link
Collaborator

kkoopa commented Mar 17, 2018 via email

@xzyfer
Copy link
Author

xzyfer commented Mar 17, 2018 via email

@kkoopa
Copy link
Collaborator

kkoopa commented Mar 17, 2018

I cannot exclude a bug in NAN, but I do not see how the changes since 2.9.2 could have this effect. diff

@kkoopa
Copy link
Collaborator

kkoopa commented Mar 17, 2018

Then again, I now have a theory. Nan::MakeCallback now returns an empty handle upon failure. Perhaps it used to return undefined or such previously. Nevermind.

@kkoopa
Copy link
Collaborator

kkoopa commented Mar 17, 2018

Alright, found the cause of the error, you are doing an asynchronous call where you meant to do a synchronous call. This issue became prominent due to the new async hooks changes made to accomodate Node 10.

--- a/src/callback_bridge.h
+++ b/src/callback_bridge.h
@@ -107,7 +107,7 @@ T CallbackBridge<T, L>::operator()(std::vector<void*> argv) {
     argv_v8.push_back(Nan::New(wrapper));

     return this->post_process_return_value(
-      this->callback->Call(argv_v8.size(), &argv_v8[0])
+      Nan::Call(*callback, argv_v8.size(), &argv_v8[0]).ToLocalChecked()
     );
   } else {
     /*

@xzyfer
Copy link
Author

xzyfer commented Mar 17, 2018 via email

@kkoopa
Copy link
Collaborator

kkoopa commented Mar 17, 2018

While the problem has been fixed, I still do not know precisely why it occurred, or if it can be easily prevented from our end, so this issue is still not resolved. Perhaps @ofrobots can take a look next week?

@saper
Copy link
Contributor

saper commented Mar 18, 2018

Strange, always trying to do Nan::Get() for a third time on that object causes a crash, even asking for the same property three times.

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

No branches or pull requests

3 participants