There is a V8 crashes Problem for binding to Node.js
-
Hi All,
I am trying to make a Qt binding to Node.js, hope it can run QML on Node.js. The following is the source code of my project:
https://github.com/cfsghost/brig
The problem is, process crashes when QQmlEngine was creating as below:
@v8::internal::Heap::Allocate (this=0xe2a080, map=0x0, space=v8::internal::NEW_SPACE) at ../3rdparty/v8/src/heap.cc:3895
3895 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type());
(gdb) bt
#0 v8::internal::Heap::Allocate (this=0xe2a080, map=0x0, space=v8::internal::NEW_SPACE) at ../3rdparty/v8/src/heap.cc:3895
#1 0x00007ffff783ae9b in v8::internal::Heap::AllocateForeign (this=<optimized out>,
address=0x7ffff5505a20 <QV8ContextWrapper::Getter(v8::Localv8::String, v8::AccessorInfo const&)> "AWAVAUATI\211\374USH\211\363H\201", <incomplete sequence \354\250>, pretenure=<optimized out>) at ../3rdparty/v8/src/heap.cc:3247
#2 0x00007ffff78190b1 in v8::internal::Factory::NewForeign (this=0xe2a070,
addr=0x7ffff5505a20 <QV8ContextWrapper::Getter(v8::Localv8::String, v8::AccessorInfo const&)> "AWAVAUATI\211\374USH\211\363H\201", <incomplete sequence \354\250>, pretenure=v8::internal::NOT_TENURED) at ../3rdparty/v8/src/factory.cc:415
#3 0x00007ffff77b60af in FromCData<v8::Handlev8::Value ()(v8::Localv8::String, v8::AccessorInfo const&)> (
obj=0x7ffff5505a20 <QV8ContextWrapper::Getter(v8::Localv8::String, v8::AccessorInfo const&)>) at ../3rdparty/v8/src/api.h:131
#4 v8::FunctionTemplate::SetNamedInstancePropertyHandler (this=0xe7b5e0,
getter=getter@entry=0x7ffff5505a20 <QV8ContextWrapper::Getter(v8::Localv8::String, v8::AccessorInfo const&)>,
setter=setter@entry=0x7ffff5505130 <QV8ContextWrapper::Setter(v8::Localv8::String, v8::Localv8::Value, v8::AccessorInfo const&)>,
query=query@entry=0x0, remover=remover@entry=0x0, enumerator=0x0, is_fallback=is_fallback@entry=true, data=data@entry=...)
at ../3rdparty/v8/src/api.cc:1224
#5 0x00007ffff77b7b2f in v8::ObjectTemplate::SetFallbackPropertyHandler (this=0xe65048,
getter=0x7ffff5505a20 <QV8ContextWrapper::Getter(v8::Localv8::String, v8::AccessorInfo const&)>,
setter=0x7ffff5505130 <QV8ContextWrapper::Setter(v8::Localv8::String, v8::Localv8::Value, v8::AccessorInfo const&)>, query=0x0, remover=0x0,
enumerator=<optimized out>, data=...) at ../3rdparty/v8/src/api.cc:1403
#6 0x00007ffff5506804 in QV8ContextWrapper::init(QV8Engine) () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#7 0x00007ffff54f64fc in QV8Engine::QV8Engine(QJSEngine*, QV8Engine::ContextOwnership) () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#8 0x00007ffff54e8089 in QJSEngine::QJSEngine(QJSEnginePrivate&, QObject*) () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#9 0x00007ffff53f1ca0 in QQmlEngine::QQmlEngine(QObject*) () from /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5
#10 0x00007ffff634b0a7 in Brig::QmlEngineWrap::QmlEngineWrap() () from /home/fred/opensource-work/brig/build/Release/brig.node
#11 0x00007ffff634b0fd in Brig::QmlEngineWrap::New(v8::Arguments const&) () from /home/fred/opensource-work/brig/build/Release/brig.node
#12 0x000000000071dcc0 in v8::internal::Builtin_HandleApiCallConstruct(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>, v8::internal::Isolate*) ()@It seems that Qt5V8 is accessing invalid memory address because there are two V8 libraries(Node.js and Qt5V8) running.
Is there any way to make two V8 Engines to run well without affecting each other?