Repository navigation
SetMethod throwing exception after upgrading to v8.0.0 #644
Copy link
Copy link
Closed
Description
- Node.js Version: v8.0.0
- OS: Windows 10 x64
- Scope (install, code, runtime, meta, other?): Runtime (native/embedding)
- Module (and version) (if relevant):
I embedded successfully NodeJS v7.10.0 into my C++ project. After updating to v8.0.0, I getting Access violation reading location on first line of stacktrace.
Stacktrace:
node.dll!v8::FunctionTemplate::SetCallHandler(void(*)(const v8::FunctionCallbackInfo<v8::Value> &) callback, v8::Local<v8::Value> data) Line 1393 C++
node.dll!v8::FunctionTemplateNew(v8::internal::Isolate * isolate, void(*)(const v8::FunctionCallbackInfo<v8::Value> &) callback, v8::Local<v8::Value> data, v8::Local<v8::Signature> signature, int length, bool do_not_cache, v8::Local<v8::Private> cached_property_name) Line 1309 C++
node.dll!v8::FunctionTemplate::New(v8::Isolate * isolate, void(*)(const v8::FunctionCallbackInfo<v8::Value> &) callback, v8::Local<v8::Value> data, v8::Local<v8::Signature> signature, int length, v8::ConstructorBehavior behavior) Line 1332 C++
nodejs-module.dll!node::gameModule::Initialize(v8::Local<v8::Object> target, v8::Local<v8::Value> unused, v8::Local<v8::Context> context) Line 176 C++
node.dll!node::Binding(const v8::FunctionCallbackInfo<v8::Value> & args) Line 2744 C++
node.dll!v8::internal::FunctionCallbackArguments::Call(void(*)(const v8::FunctionCallbackInfo<v8::Value> &) f) Line 26 C++
node.dll!v8::internal::`anonymous namespace'::HandleApiCallHelper<0>(v8::internal::Isolate * isolate, v8::internal::Handle<v8::internal::HeapObject> function, v8::internal::Handle<v8::internal::HeapObject> new_target, v8::internal::Handle<v8::internal::FunctionTemplateInfo> fun_data, v8::internal::Handle<v8::internal::Object> receiver, v8::internal::BuiltinArguments args) Line 113 C++
node.dll!v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments args, v8::internal::Isolate * isolate) Line 140 C++
node.dll!v8::internal::Builtin_HandleApiCall(int args_length, v8::internal::Object * * args_object, v8::internal::Isolate * isolate) Line 128 C++
Code:
void Initialize(v8::Local<v8::Object> target, v8::Local<v8::Value> unused, v8::Local<v8::Context> context)
{
Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "onResourceLoad", OnResourceLoadFunction); //Line 176 of nodejs-module
env->SetMethod(target, "onEvent", OnEventFunction);
...
NODE_MODULE_CONTEXT_AWARE_BUILTIN(gameModule, node::gameModule::Initialize);JS:
global.gameModule = process.binding('gameModule');Reactions are currently unavailable
Activity
[-]SetMethod throwing exception after upgrading into v8.0.0[/-][+]SetMethod throwing exception after upgrading to v8.0.0[/+]bnoordhuis commentedon May 31, 2017
Have you tried a rebuild from scratch? My hunch would be that some of your object files are still compiled for the older node version.
gamelaster commentedon May 31, 2017
I tried
Rebuildin VS, not helped 😞bnoordhuis commentedon May 31, 2017
Okay, what happens when you run it under a debugger?
gamelaster commentedon May 31, 2017
I didn't have Debugger implemented yet. I have just Visual Studio Debugger available.

bnoordhuis commentedon May 31, 2017
It looks like a failed JS heap allocation inside V8 but as to why it fails, your guess is as good as mine.
gamelaster commentedon May 31, 2017
I checked the differences on setup of NodeJS (environment etc.), one of them is adding the
Environment::AsyncHooks::ExecScopebefore loading environment, but after adding that I can't compile because unresolved external symbols (node::Assert, I tried to solve it before (I can't use NodeJS's V8 Array Buffer Allocator for this)).I just don't know where to search, everything works perfectly on v7.10.0 🤔
gamelaster commentedon Jun 8, 2017
bump, tested on v8.10.0, same behavior :-/
bnoordhuis commentedon Jun 8, 2017
I see you emailed me your code but I don't have time to look into it (and neither do I use Windows.) You'll have to figure this out yourself.
refack commentedon Jun 8, 2017
@nodejs/async_hooks
refack commentedon Jun 8, 2017
@gamelaster can you send me your code?
gamelaster commentedon Jun 8, 2017
@refack I sent email to mail in NodeJS readme.
refack commentedon Jun 8, 2017
looks like nodejs/node@c0bde73 broke embedding (at least on windows)
AndreasMadsen commentedon Jul 2, 2017
@refack the addon tests runs on windows CI, correct?
refack commentedon Jul 2, 2017
Yes. https://github.com/nodejs/node/blob/master/vcbuild.bat#L48
trevnorris commentedon Jul 3, 2017
@refack Have an idea why this passes in Windows CI, or how we might replicate this in an addon test?
gamelaster commentedon Jul 6, 2017
AndreasMadsen/node@48ef6a2 doesn't fixed this issue.
gireeshpunathil commentedon Mar 12, 2018
@gamelaster - is this still an issue for you? that is, with the latest version of node? please let me know.
gireeshpunathil commentedon Mar 15, 2018
closing due to inactivity, please re-open if it is still outstanding.