nan icon indicating copy to clipboard operation
nan copied to clipboard

Nan 2.10.0 causing errors

Open xzyfer opened this issue 7 years ago • 8 comments

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 https://github.com/sass/node-sass/issues/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 avatar Mar 17 '18 07:03 xzyfer

Do not see how any of the changes could be related. The stack traces do not indicate any error with makecallback and the deprecation should not have affected anything, since that only makes the compiler emit warnings.

On March 17, 2018 9:02:37 AM GMT+02:00, Michael Mifsud [email protected] wrote:

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 https://github.com/sass/node-sass/issues/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.

kkoopa avatar Mar 17 '18 10:03 kkoopa

I'll aim to do a bisect this week to find the offending commit, however we are fairly confident the nan bump to be the root cause of the error.

It's possible we have always had a latent bug that this change has surfaced.

On 17 Mar. 2018 9:18 pm, "Benjamin Byholm" [email protected] wrote:

Do not see how any of the changes could be related. The stack traces do not indicate any error with makecallback and the deprecation should not have affected anything, since that only makes the compiler emit warnings.

On March 17, 2018 9:02:37 AM GMT+02:00, Michael Mifsud < [email protected]> wrote:

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 https://github.com/sass/node-sass/issues/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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nodejs/nan/issues/755#issuecomment-373909418, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWGMUT40-IiM_ISqYOZuhCf1_gUGWks5tfOL-gaJpZM4SusrQ .

xzyfer avatar Mar 17 '18 11:03 xzyfer

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 avatar Mar 17 '18 11:03 kkoopa

~~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 avatar Mar 17 '18 11:03 kkoopa

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 {
     /*

kkoopa avatar Mar 17 '18 12:03 kkoopa

Great, thanks. I can't try this adjustment on our end and see how it goes. cc @saper

On 17 Mar. 2018 11:29 pm, "Benjamin Byholm" [email protected] wrote:

Alright, found the cause of the error, you are doing an asynchornous call where you meant to do a synchronous call. This issue became prominent due to the new asynch 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 { /*

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nodejs/nan/issues/755#issuecomment-373916534, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWPqueV-bzGe3wc4wuSbN7UhH7RZHks5tfQG7gaJpZM4SusrQ .

xzyfer avatar Mar 17 '18 12:03 xzyfer

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?

kkoopa avatar Mar 17 '18 13:03 kkoopa

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.

saper avatar Mar 18 '18 18:03 saper