镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

SetMethod throwing exception after upgrading to v8.0.0 #644

Closed

Description

@gamelaster
  • 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');

Activity

  1. changed the title [-]SetMethod throwing exception after upgrading into v8.0.0[/-] [+]SetMethod throwing exception after upgrading to v8.0.0[/+] on May 31, 2017
  2. bnoordhuis commented on May 31, 2017

    @bnoordhuis
    Member

    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.

  3. gamelaster commented on May 31, 2017

    @gamelaster
    Author

    I tried Rebuild in VS, not helped 😞

  4. bnoordhuis commented on May 31, 2017

    @bnoordhuis
    Member

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

  5. gamelaster commented on May 31, 2017

    @gamelaster
    Author

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

  6. bnoordhuis commented on May 31, 2017

    @bnoordhuis
    Member

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

  7. gamelaster commented on May 31, 2017

    @gamelaster
    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 🤔

  8. gamelaster commented on Jun 8, 2017

    @gamelaster
    Author

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

  9. bnoordhuis commented on Jun 8, 2017

    @bnoordhuis
    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.

  10. refack commented on Jun 8, 2017

    @refack

    @nodejs/async_hooks

  11. refack commented on Jun 8, 2017

    @refack

    @gamelaster can you send me your code?

  12. self-assigned this
    on Jun 8, 2017
  13. gamelaster commented on Jun 8, 2017

    @gamelaster
    Author

    @refack I sent email to mail in NodeJS readme.

  14. refack commented on Jun 8, 2017

    @refack

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

  15. AndreasMadsen commented on Jul 2, 2017

    @AndreasMadsen
    Member

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

  16. trevnorris commented on Jul 3, 2017

    @trevnorris

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

  17. gamelaster commented on Jul 6, 2017

    @gamelaster
    Author

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

  18. gireeshpunathil commented on Mar 12, 2018

    @gireeshpunathil
    Member

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

  19. gireeshpunathil commented on Mar 15, 2018

    @gireeshpunathil
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions