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

SetMethod throwing exception after upgrading to v8.0.0 #644

Closed
gamelaster opened this issue May 31, 2017 · 18 comments
Closed

SetMethod throwing exception after upgrading to v8.0.0 #644

gamelaster opened this issue May 31, 2017 · 18 comments
Assignees

Comments

@gamelaster
Copy link

  • 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');
@gamelaster gamelaster changed the title SetMethod throwing exception after upgrading into v8.0.0 SetMethod throwing exception after upgrading to v8.0.0 May 31, 2017
@bnoordhuis
Copy link
Member

bnoordhuis commented 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
Copy link
Author

I tried Rebuild in VS, not helped 😞

@bnoordhuis
Copy link
Member

Okay, what happens when you run it under a debugger?

@gamelaster
Copy link
Author

I didn't have Debugger implemented yet. I have just Visual Studio Debugger available.
image

@bnoordhuis
Copy link
Member

It looks like a failed JS heap allocation inside V8 but as to why it fails, your guess is as good as mine.

@gamelaster
Copy link
Author

I checked the differences on setup of NodeJS (environment etc.), one of them is adding the Environment::AsyncHooks::ExecScope before 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
Copy link
Author

bump, tested on v8.10.0, same behavior :-/

@bnoordhuis
Copy link
Member

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
Copy link

refack commented Jun 8, 2017

@nodejs/async_hooks

@refack
Copy link

refack commented Jun 8, 2017

@gamelaster can you send me your code?

@refack refack self-assigned this Jun 8, 2017
@gamelaster
Copy link
Author

@refack I sent email to mail in NodeJS readme.

@refack
Copy link

refack commented Jun 8, 2017

looks like nodejs/node@c0bde73 broke embedding (at least on windows)

@AndreasMadsen
Copy link
Member

@refack the addon tests runs on windows CI, correct?

@refack
Copy link

refack commented Jul 2, 2017

@trevnorris
Copy link

@refack Have an idea why this passes in Windows CI, or how we might replicate this in an addon test?

@gamelaster
Copy link
Author

gamelaster commented Jul 6, 2017

AndreasMadsen/node@48ef6a2 doesn't fixed this issue.

@gireeshpunathil
Copy link
Member

@gamelaster - is this still an issue for you? that is, with the latest version of node? please let me know.

@gireeshpunathil
Copy link
Member

closing due to inactivity, please re-open if it is still outstanding.

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

No branches or pull requests

6 participants