Closed
Description
Hello All,
I have written a native addon [Using NAN] for my cpp [pub-sub] library.
- Subscriber that is receving the events from the publisher.
- Calling the application callback.
So, my native addon is providing wrapper APIs for cpp library.
- Js application will create subscriber object and will subscribe for event. Internally I am creating c++ subscriber, subscribe to it and will register addon callback to cpp layer.
- I am using libuv for getting the asyn callback from c++ layer to addon layer, and then I am calling NAN callback for calling js callback.
For callback implementation in addon, I followed: #1171
Issue:
After receving some events on subscriber side, subscriber sample is crashing [Segmentation fault].
Crash logs:
(gdb) bt
#0 0x0000000000f87c74 in v8::internal::JSReceiver::GetCreationContext() ()
#1 0x0000000000afd25c in v8::Object::CreationContext() ()
#2 0x0000000001225044 in node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) ()
#3 0x00007ffff47a539b in npubsub::NSubscriber::uvAsynCallback(uv_async_s*) ()
from /home/jack/pubsubrepo/build/Release/pubsub.node
#4 0x000000000143e44b in uv__async_io (loop=0x21d0500 <default_loop_struct>, w=<optimized out>, events=<optimized out>) at ../deps/uv/src/unix/async.c:118
#5 0x000000000144ffa8 in uv__io_poll (loop=loop@entry=0x21d0500 <default_loop_struct>, timeout=-1) at ../deps/uv/src/unix/linux-core.c:400
#6 0x000000000143edd6 in uv_run (loop=0x21d0500 <default_loop_struct>, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:368
#7 0x000000000122c1bd in node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) ()
#8 0x0000000001224d03 in node::Start(int, char**) ()
#9 0x00007ffff6bd8f45 in __libc_start_main (main=0x8acef0 <main>, argc=8, argv=0x7fffffffe328, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffe318) at libc-start.c:287
Observation:
There is a strange observation on my subscriber sample:
- If, I am creating my subscriber object in sample application like this:
subscriber = new subscriber(ip, port);
Result: It is working fine.
- If, I am creating the subscriber object like this
var subscriber = new subscriber(ip, port);
Result: It is crashing after receiving some events.
Environment details:
- Node.js Version: v8.11.1
- OS: Linux [Ubuntu : 14.04]
I am struggling with this issue since quite long. Any help will be appreciated.
Thanks in advance.
Metadata
Metadata
Assignees
Labels
No labels