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

Getting segmentation fault after receiving some callbacks from NAN layer #1543

Closed
jay11ca39 opened this issue Oct 11, 2018 · 18 comments
Closed

Comments

@jay11ca39
Copy link

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:

  1. If, I am creating my subscriber object in sample application like this:

subscriber = new subscriber(ip, port);

Result: It is working fine.

  1. 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.

@jay11ca39
Copy link
Author

Full backtrace:

(gdb) bt full
#0  0x0000000000f87c74 in v8::internal::JSReceiver::GetCreationContext() ()
No symbol table info available.
#1  0x0000000000afd25c in v8::Object::CreationContext() ()
No symbol table info available.
#2  0x0000000001225044 in node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) ()
No symbol table info available.
#3  0x00007ffff47a539b in npubsub::NSubscriber::uvAsynCallback(uv_async_s*) ()
   from /home/jack/pubsubrepo/build/Release/pubsub.node
No symbol table info available.
#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
        buf = "\001\000\000\000\000\000\000\000\320L2\002\000\000\000\000\200R2\002\000\000\000\000R\311\377\000\000\000\000\000`M0\002\000\000\000\000\200R2\002\000\000\000\000\240\235\377\377\377\177\000\000\320L2\002\000\000\000\000@\235\377\377\377\177", '\000' <repeats 19 times>, "\236\377\377\377\177\000\000@\236\377\377\377\177\000\000й\377\377\377\177\000\000\320L2\002\000\000\000\000\200R2\002\000\000\000\000\340\236\377\377\377\177\000\000\246\261\000\001\000\000\000\000\000\000\000\000\377\177\000\000\200\267\377\377\377\177\000\000\222\031\000\000\000\000\000\000@\242\060\002\000\000\000\000\240\235\377\377\377\177\000\000\001\002\000\000\000\000\000\000\230\302#\002\000\000\000\000V"...
        r = <optimized out>
        queue = {0x7fffffff9cb0, 0x7fffffff9cb0}
        q = <optimized out>
        h = <optimized out>
        __PRETTY_FUNCTION__ = "uv__async_io"
#5  0x000000000144ffa8 in uv__io_poll (loop=loop@entry=0x21d0500 <default_loop_struct>, timeout=-1) at ../deps/uv/src/unix/linux-core.c:400
        no_epoll_pwait = 0
        no_epoll_wait = 0
        events = {{events = 1, data = 8}, {events = 4294934528, data = 140737488331263}, {events = 4294948736, data = 18446666901737209855}, {events = 32767,
            data = 2390}, {events = 2390, data = 18446666901737177088}, {events = 32767, data = 140737488331472}, {events = 11889213, data = 18446641338091831296},
          {events = 32767, data = 11892500}, {events = 36866864, data = 17795858891150458880}, {events = 1, data = 140737488331328}, {events = 15, data = 0}, {
            events = 0, data = 36866864}, {events = 15, data = 9903397704933834752}, {events = 32513, data = 36741696}, {events = 36885152,
            data = 158341975186079744}, {events = 0, data = 140737488339376}, {events = 5407, data = 18446675560391245824}, {events = 32767,
            data = 140737488331504}, {events = 11892961, data = 18446641887847645184}, {events = 97, data = 15}, {events = 15, data = 1141615017}, {events = 256,
            data = 0}, {events = 4294951936, data = 369367220223}, {events = 0, data = 140737488339376}, {events = 5407, data = 18446675560391245824}, {
            events = 32767, data = 140737488331520}, {events = 17073464, data = 18446642300164505600}, {events = 32767, data = 16764929}, {events = 4294943680,
            data = 17795858891150491647}, {events = 32767, data = 3072}, {events = 52, data = 2475849424085975040}, {events = 0, data = 128}, {events = 0,
            data = 18446678103011885057}, {events = 32767, data = 140737488340104}, {events = 4294951936, data = 18446678103011917823}, {events = 32767,
            data = 36962976}, {events = 4294943712, data = 72314622060822527}, {events = 0, data = 36925360}, {events = 52, data = 18446643124798226432}, {
            events = 32767, data = 2305814462}, {events = 23, data = 51063781010178048}, {events = 0, data = 140737488331824}, {events = 11892500,
            data = 158341975186079744}, {events = 0, data = 4331925016}, {events = 4294943712, data = 64424542207}, {events = 0, data = 0}, {events = 36866864,
            data = 64424509440}, {events = 0, data = 6600781758}, {events = 2390, data = 158420521547988992}, {events = 0, data = 36866864}, {events = 4294951344,
            data = 24502788456447}, {events = 0, data = 140737488339376}, {events = 4294943888, data = 51079878547636223}, {events = 0, data = 5407}, {events = 15,
            data = 64424509440}, {events = 1141615017, data = 1099511627776}, {events = 4294944016, data = 18446678103011917823}, {events = 32767, data = 86}, {
            events = 4294951344, data = 24502788456447}, {events = 0, data = 140737488339376}, {events = 4294943904, data = 73329969509466111}, {events = 0,
            data = 0}, {events = 36885152, data = 18446643880712470528}, {events = 32767, data = 11891769}, {events = 36963696, data = 18446677484536594432}, {
            events = 32767, data = 140737488339824}, {events = 3974, data = 18446644086870900736}, {events = 32767, data = 16722579}, {events = 4294951928,
            data = 18446677484536627199}, {events = 32767, data = 140737488339960}, {events = 4294951200, data = 18446644567907270655}, {events = 32767,
            data = 16837356}, {events = 23137, data = 833223622656}, {events = 6, data = 48}, {events = 96, data = 18446644705346191360}, {events = 32767,
            data = 446676598790}, {events = 3974, data = 18446646766930497415}, {events = 32767, data = 140737488339824}, {events = 36957728, data = 0}, {
            events = 0, data = 140737488332416}, {events = 4294944560, data = 72174086435930111}, {events = 0, data = 140733193388156}, {events = 16839629,
            data = 23201413332992}, {events = 0, data = 140737488339376}, {events = 4294952072, data = 4295000063}, {events = 5406, data = 140737488337360}, {
            events = 4143421280, data = 32767}, {events = 0, data = 36963128}, {events = 3974, data = 158755425917861888}, {events = 0, data = 140737488332288}, {
            events = 11892500, data = 158341975186079744}, {events = 0, data = 4294967424}, {events = 4294944288, data = 30064803839}, {events = 0, data = 0}, {
            events = 36866864, data = 30064771072}, {events = 0, data = 6420377038}, {events = 4294944480, data = 158420521548021759}, {events = 0,
            data = 36961512}, {events = 0, data = 158755288478908416}, {events = 0, data = 36960056}, {events = 36958664, data = 51078912179961856}, {events = 0,
            data = 140737488339824}, {events = 4294944640, data = 158648738930262015}, {events = 0, data = 140737488338528}, {events = 4294950512, data = 32767}, {
            events = 0, data = 1407396362846208}, {events = 4294951072, data = 45788646375423}, {events = 0, data = 11889213}, {events = 4294944592,
            data = 51077898567712767}, {events = 0, data = 36866864}, {events = 16764929, data = 18446646217174679553}, {events = 32767, data = 4}, {events = 0,
            data = 18446674941915955200}, {events = 32767, data = 0}, {events = 36963128, data = 18446654600950841344}, {events = 32767, data = 140737488339824}, {
            events = 4294944752, data = 72325655831805951}, {events = 0, data = 140737488332688}, {events = 17078425, data = 18446646973088923648}, {
            events = 32767, data = 17063905067009}, {events = 36866864, data = 18446678068652146688}, {events = 32767, data = 50}, {events = 35633992,
            data = 18446677484536594432}, {events = 32767, data = 140737488334496}, {events = 36938288, data = 18446671918258978816}, {events = 32767,
            data = 140737488338544}, {events = 4294951792, data = 18446647247966863359}, {events = 32767, data = 16733988}, {events = 4294951792,
            data = 18446674941915987967}, {events = 32767, data = 140737488339824}, {events = 4294951200, data = 18446677484536627199}, {events = 32767,
            data = 140737488338464}, {events = 4294944928, data = 72358095719792639}, {events = 0, data = 140737488332896}, {events = 4294951792,
            data = 18446678068652179455}, {events = 32767, data = 140733193392005}, {events = 4294945280, data = 158755494637371391}, {events = 0,
            data = 140737488332960}, {events = 16837060, data = 158420521547988992}, {events = 0, data = 36961352}, {events = 4294944880,
            data = 18446674392160174079}, {events = 32767, data = 140737488339696}, {events = 36961352, data = 18446648553636888576}, {events = 32767,
            data = 140737488339232}, {events = 4294945280, data = 17046725230591}, {events = 0, data = 140737488339232}, {events = 11889213,
            data = 18446648553636888576}, {events = 32767, data = 11892500}, {events = 36866864, data = 73402296758697984}, {events = 1, data = 140737488333008}, {
            events = 6, data = 0}, {events = 0, data = 36866864}, {events = 6, data = 15407675440407511040}, {events = 32513, data = 140737488333312}, {
            events = 36885152, data = 158341975186079744}, {events = 0, data = 140737488339248}, {events = 3355, data = 18446675010635431936}, {events = 32767,
            data = 140737488333184}, {events = 11892961, data = 18446648897234272256}, {events = 32767, data = 6}, {events = 6, data = 3615702597}, {events = 256,
            data = 36866864}, {events = 4294951808, data = 369367220223}, {events = 0, data = 140737488339248}, {events = 3355, data = 18446675010635431936}, {
            events = 32767, data = 140737488333200}, {events = 17073464, data = 18446649515709562880}, {events = 32767, data = 16764929}, {events = 36866864,
            data = 18446675010635431936}, {events = 32767, data = 2875}, {events = 4294951216, data = 18446649653148549119}, {events = 32767, data = 11892961}, {
            events = 4294951072, data = 18446677553256103935}, {events = 32767, data = 140737488339976}, {events = 4294951808, data = 18446677553256103935}, {
            events = 32767, data = 11889213}, {events = 4294945408, data = 51077898567712767}, {events = 0, data = 36866864}, {events = 4294951216,
            data = 18446649721867993089}, {events = 32767, data = 12}, {events = 0, data = 158341975186079744}, {events = 0, data = 12}, {events = 832093222,
            data = 18446677553256103681}, {events = 32767, data = 36885152}, {events = 36866864, data = 18446675010635431936}, {events = 32767, data = 3391}, {
            events = 4294951216, data = 18446650477782269951}, {events = 32767, data = 11892961}, {events = 36866864, data = 51539607552}, {events = 0,
            data = 14259371923292028940}, {events = 0, data = 256}, {events = 0, data = 140737488339840}, {events = 86, data = 18446675010635431936}, {
            events = 32767, data = 3391}, {events = 4294951216, data = 18446650546501746687}, {events = 32767, data = 17073464}, {events = 4294945632,
            data = 72004821774794751}, {events = 0, data = 140737488333664}, {events = 11892961, data = 18446650752660144128}, {events = 32767, data = 7}...}
        pe = 0x7fffffffa1c0
        e = {events = 1, data = 8}
        real_timeout = -1
        q = <optimized out>
        w = <optimized out>
        sigset = {__val = {140737488336768, 0, 140737488331264, 16849474, 2, 140737488336448, 0, 6399, 36741696, 36812448, 140737488331216, 7, 0, 0, 0,
            140737336809392}}
        sigmask = 0
        base = 2082704301
        have_signals = <optimized out>
        nevents = 0
        count = 48
        nfds = 1
        fd = <optimized out>
        op = <optimized out>
        i = <optimized out>
        __PRETTY_FUNCTION__ = "uv__io_poll"
#6  0x000000000143edd6 in uv_run (loop=0x21d0500 <default_loop_struct>, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:368
        timeout = <optimized out>
        r = 1
#7  0x000000000122c1bd in node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) ()
No symbol table info available.
#8  0x0000000001224d03 in node::Start(int, char**) ()
No symbol table info available.
#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
        result = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 8750135525826613513, 9104920, 140737488347936, 0, 0, -8750135526510833399, -8750119565224980215},
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x15634d0 <__libc_csu_init>, 0x7fffffffe328}, data = {prev = 0x0, cleanup = 0x0,
              canceltype = 22426832}}}
        not_first_call = <optimized out>
#10 0x00000000008aee41 in _start ()
No symbol table info available.

@jay11ca39
Copy link
Author

Hello @gireeshpunathil ,
Can you please provide your opinion for this issue.
It will be a great help.

@gireeshpunathil
Copy link
Member

hello @jay11ca39 - how are you, nice to see you after some time!

Like last time, I am suspecting this has to do with one or more of: object scope, access or life cycle. Can you please provide your code of npubsub::NSubscriber::uvAsynCallback as well as illustrate the pub-sub cycle with threads in view?

@jay11ca39
Copy link
Author

Hi @gireeshpunathil ,

Following is the uv callback:

void NSubscriber::uvAsynCallback(uv_async_t* handle)
{
	SubData *data =  (SubData *)static_cast<SubData*>(handle->data);

	//call js application callback
	Nan::HandleScope scope;
	Local<Object> addonMessage;

	v8::Local<v8::Value> argv[] {Nan::Null()};
	addonMessage = NMessage::NewInstance(0, argv);
	NMessage* unwrappedMessage = ObjectWrap::Unwrap<NMessage>(addonMessage);
	unwrappedMessage->nativeHandle = data->message;

	const unsigned argc = 2;
	v8::Local<v8::Value> topic = (Nan::New((data->topic).c_str())).ToLocalChecked();
	v8::Local<v8::Value> argv[argc] = { topic, addonMessage  };
	((data ->nSubscriber)->jsCallback).Call(2, argv);
}
typedef struct
{
	NSubscriber* nSubscriber; // Class object needs for callback as Application callback is stored in this class
	Message *message;
	std::string topic;
} SubData;

I am calling uvAsynCallback from the callback that I received from the native layer as follows:
uv_async_send(&(obj->uvAsyncHandle)); //In this handle's data I filled the subData.

Regarding the pub-sub model:

  1. JS Publisher that is publishing message.
  2. JS subscriber that is receiving the message.
    In Core CPP logic subscriber is having a thread that receive the message and call the application callback [In my case , cpp layer will call addon callback and from adddon callback I will call uv_async_send(&(obj->uvAsyncHandle)) which will call uvAsynCallback which will finally call the js callback.]

@jay11ca39
Copy link
Author

Hi @gireeshpunathil ,
Can you please let me know, if any other information is needed.

@gireeshpunathil
Copy link
Member

I guess the failure is coming from:

((data ->nSubscriber)->jsCallback).Call(2, argv);

wherein the jsCallback field (a v8::Function object) is not created in the current context that is prevalent in the JS execution context. If so, we want a new instance of this function created in the current execution context.

/cc @addaleax for an expert opinion.

@jay11ca39
Copy link
Author

Yes @gireeshpunathil ,
You are right the issue is created by the line:
((data ->nSubscriber)->jsCallback).Call(2, argv);

When I commented this line, It was working fine.

Hello @addaleax
Can you please provide you opinion on this.

@addaleax
Copy link
Member

nodejs/nan#813 is probably unrelated, but might be worth looking at.

My guess is that jsCallback is not properly initialized in some way. A stack trace for a node-gyp rebuild --debug build might help?

@jay11ca39
Copy link
Author

Hello @addaleax ,

Following are the logs:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/jack/pubsubrepo/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/jack/pubsubrepo/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/jack/pubsubrepo/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/jack/.node-gyp/8.9.4/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/jack/.node-gyp/8.9.4',
gyp info spawn args '-Dnode_gyp_dir=/home/jack/pubsubrepo/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/jack/.node-gyp/8.9.4/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/jack/pubsubrepo/',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/jack/pubsubrepo/build'

CXX(target) Release/obj.target/npubsub/src/nmessage.o
CXX(target) Release/obj.target/npubsub/src/npublisher.o
CXX(target) Release/obj.target/npubsub/src/nsubscriber.o
../src/nsubscriber.cc: In static member function ‘static void npubsub::NSubscriber::uvAsynCallback(uv_async_t*)’:
../src/nsubscriber.cc:119:63: warning: ‘v8::Localv8::Value Nan::Callback::Call(int, v8::Localv8::Value*) const’ is deprecated [-Wdeprecated-declarations]
((data ->nSubscriber)->jsSubCallback).Call(1, argv);
^
In file included from ../src/nsubscriber.h:23:0,
from ../src/nsubscriber.cc:20:
../node_modules/nan/nan.h:1647:3: note: declared here
Call(int argc, v8::Localv8::Value argv[]) const {
^
SOLINK_MODULE(target) Release/obj.target/pubsub.node
COPY Release/pubsub.node
make: Leaving directory `/home/jack/pubsubrepo/build'
gyp info ok

@jay11ca39
Copy link
Author

Hello @addaleax and @gireeshpunathil ,
Please let me know, if any additional information is required.

@jay11ca39
Copy link
Author

Hello @addaleax and @gireeshpunathil ,

Previously I was using:
((data ->nSubscriber)->jsCallback).Call(2, argv);

Now, I used:
Nan::Call(((data ->nSubscriber)->jsSubCallback), Nan::GetCurrentContext()->Global(), 2, argv);

But, still it is giving the same crash.. :(

Can you please help me in this.?

@gireeshpunathil
Copy link
Member

@jay11ca39 - if I understand correctly, @addaleax 's suggestion was to:

node-gyp rebuild --debug

and then run to crash with ulimit -c unlimited, and launch the core in gdb, collect the stack trace.

will you please follow that and get the stack?

@jay11ca39
Copy link
Author

Hello @gireeshpunathil ,
Following I have followed:

  1. Built the native addon with: node-gyp rebuild --debug

  2. Ran my sample application:
    $ gdb node subscriber.js

Following is the output of $ bt full

Program received signal SIGSEGV, Segmentation fault.
0x0000000000afd251 in v8::Object::CreationContext() ()
(gdb)
(gdb) bt full
#0 0x0000000000afd251 in v8::Object::CreationContext() ()
No symbol table info available.
#1 0x0000000001225044 in node::MakeCallback(v8::Isolate*, v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value) ()
No symbol table info available.
#2 0x00007ffff47a09da in Nan::Callback::Call_ (this=0x23044f8, isolate=0x21e8ac0, target=..., argc=2, argv=0x7fffffff9c70) at ../node_modules/nan/nan.h:1738
scope = {scope = {v8::HandleScope = {isolate_ = 0x21e8ac0, prev_next_ = 0x223f268, prev_limit_ = 0x2240b50}, escape_slot_ = 0x223f260}}
callback = {val_ = 0x0}
#3 0x00007ffff47a093c in Nan::Callback::Call (this=0x23044f8, argc=2, argv=0x7fffffff9c70) at ../node_modules/nan/nan.h:1658
isolate = 0x21e8ac0
scope = {v8::HandleScope = {isolate_ = 0x21e8ac0, prev_next_ = 0x223f250, prev_limit_ = 0x2240b50}, escape_slot_ = 0x223f248}
#4 0x00007ffff479f09b in npubsub::NSubscriber::uvAsynCallback (handle=0x2304500) at ../src/nsubscriber.cc:128
argc = 2
topic = {val_ = 0x223f240}
argv = {{val_ = 0x223f240}, {val_ = 0x223f238}}
data = 0x7fffd400c7b0
scope = {scope = {isolate_ = 0x21e8ac0, prev_next_ = 0x223f230, prev_limit_ = 0x223f230}}
addonEvent = {val_ = 0x223f238}
lock = {_M_device = 0x223f240, _M_owns = 56}
#5 0x000000000143e44b in uv__async_io (loop=0x21d0500 <default_loop_struct>, w=, events=) at ../deps/uv/src/unix/async.c:118
buf = "\001\000\000\000\000\000\000\000\020C2\002\000\000\000\000\220\235\377\377\377\177\000\000=2\002\000\000\000\000\060\235\377\377\377\177", '\000' <repeats 18 times>, "\360\235\377\377\377\177\000\000\060\236\377\377\377\177\000\000\300\271\377\377\377\177\000\000=2\002\000\000\000\000\020C2\002\000\000\000\000О\377\377\377\177\000\000\246\261\000\001\000\000\000\000\000\000\000\000\377\177\000\000p\267\377\377\377\177\000\000\306\031\000\000\000\000\000\000\360\222\060\002\000\000\000\000\220\235\377\377\377\177\000\000\001\002\000\000\000\000\000\000\230\302#\002\000\000\000\000/\n\000\000\000\000\000\000\340\235\377\377\377\177\000\000\020\000\000\000\000\000\000\000`=2\002\000\000\000\000\000"...
r =
queue = {0x7fffffff9cc0, 0x7fffffff9cc0}
q =
h =
PRETTY_FUNCTION = "uv__async_io"
#6 0x000000000144ffa8 in uv__io_poll (loop=loop@entry=0x21d0500 <default_loop_struct>, timeout=-1) at ../deps/uv/src/unix/linux-core.c:400
no_epoll_pwait = 0
no_epoll_wait = 0
events = {{events = 1, data = 8}, {events = 4294934528, data = 140737488331279}, {events = 4294949312, data = 18446641544250294271}, {events = 32767,
data = 16851024}, {events = 36849680, data = 158211923576356864}, {events = 0, data = 140737488331760}, {events = 11889213,
data = 18446641406811308032}, {events = 32767, data = 11892500}, {events = 36863536, data = 17795858891150458880}, {events = 1,
data = 140737488331344}, {events = 15, data = 0}, {events = 0, data = 36863536}, {events = 15, data = 16416795255191371776}, {events = 32513,
data = 140737488331760}, {events = 36881120, data = 158327681534918656}, {events = 0, data = 140737488339392}, {events = 5407,
data = 18446675629110722560}, {events = 32767, data = 140737488331520}, {events = 11892961, data = 11196979740672}, {events = 97, data = 15}, {
events = 15, data = 1050308343}, {events = 256, data = 0}, {events = 4294951952, data = 369367220223}, {events = 0, data = 140737488339392}, {
events = 5407, data = 18446675629110722560}, {events = 32767, data = 140737488331536}, {events = 17073464, data = 18446642368883982336}, {
events = 32767, data = 16764929}, {events = 4294967295, data = 17795858891150491392}, {events = 32767, data = 3072}, {events = 52,
data = 4104198811650359296}, {events = 0, data = 128}, {events = 0, data = 18446678171731361793}, {events = 32767, data = 140737488340120}, {
events = 4294951952, data = 18446678171731394559}, {events = 32767, data = 36967536}, {events = 4294943728, data = 72314622060822527}, {events = 0,
data = 140737488337792}, {events = 25, data = 18446643193517703168}, {events = 32767, data = 3822333006}, {events = 23, data = 51063781010178048}, {
events = 0, data = 140737488331840}, {events = 11892500, data = 158327681534918656}, {events = 0, data = 4331929576}, {events = 4294943728,
data = 64424542207}, {events = 0, data = 0}, {events = 36863536, data = 64424509440}, {events = 0, data = 8117300302}, {events = 36683344,
---Type to continue, or q to quit---
data = 158403204239851524}, {events = 0, data = 36863536}, {events = 4294951360, data = 24502788456447}, {events = 0, data = 140737488339392}, {
events = 4294943904, data = 51079878547636223}, {events = 0, data = 140733193393439}, {events = 15, data = 64424509440}, {events = 1050308343,
data = 1099511627776}, {events = 2110, data = 18446678171731361792}, {events = 32767, data = 86}, {events = 4294951360, data = 24502788456447}, {
events = 0, data = 140737488339392}, {events = 4294943920, data = 73329969509466111}, {events = 0, data = 0}, {events = 36881120,
data = 18446643949431947264}, {events = 32767, data = 11891769}, {events = 36968256, data = 18446677553256071168}, {events = 32767,
data = 140737488339840}, {events = 3974, data = 18446644155590377472}, {events = 32767, data = 16722579}, {events = 4294951944,
data = 18446677553256103935}, {events = 32767, data = 140737488339976}, {events = 4294951216, data = 18446644636626747391}, {events = 32767,
data = 16837356}, {events = 23121, data = 833223622656}, {events = 6, data = 48}, {events = 96, data = 18446644774065668096}, {events = 32767,
data = 446676598790}, {events = 3974, data = 18446646835649974151}, {events = 32767, data = 140737488339840}, {events = 36962288, data = 0}, {
events = 0, data = 140737488332432}, {events = 4294944576, data = 72174086435930111}, {events = 0, data = 140733193388156}, {events = 16839629,
data = 23201413332992}, {events = 0, data = 140737488339392}, {events = 4294952088, data = 4295000063}, {events = 5406, data = 140737488332672}, {
events = 4143421280, data = 32767}, {events = 0, data = 36967688}, {events = 3974, data = 158775010968731648}, {events = 0, data = 140737488332288}, {
events = 11892500, data = 158327681534918656}, {events = 0, data = 4294967424}, {events = 4294944304, data = 30064803839}, {events = 0, data = 0}, {
events = 36863536, data = 30064771072}, {events = 0, data = 5177157262}, {events = 4294944496, data = 158403204239884287}, {events = 0,
data = 36966072}, {events = 0, data = 158774873529778176}, {events = 0, data = 36964616}, {events = 36963224, data = 51078912179961856}, {events = 0,
data = 140737488339840}, {events = 4294944656, data = 158170451372179455}, {events = 0, data = 140737488338544}, {events = 4294950528, data = 32767}, {
events = 0, data = 1407396362846208}, {events = 4294951088, data = 45788646375423}, {events = 0, data = 11889213}, {events = 4294944608,
data = 51077898567712767}, {events = 0, data = 36863536}, {events = 16764929, data = 18446646285894156289}, {events = 32767, data = 4}, {events = 0,
data = 18446675010635431936}, {events = 32767, data = 0}, {events = 36967688, data = 18446654669670318080}, {events = 32767, data = 140737488339840}, {
events = 4294944768, data = 72325655831805951}, {events = 0, data = 140737488332704}, {events = 17078425, data = 18446647041808400384}, {
events = 32767, data = 17063905067009}, {events = 36863536, data = 18446678137371623424}, {events = 32767, data = 50}, {events = 35633992,
data = 18446677553256071168}, {events = 32767, data = 140737488334512}, {events = 36826928, data = 18446671986978455552}, {events = 32767,
data = 140737488338560}, {events = 4294951808, data = 18446647316686340095}, {events = 32767, data = 16733988}, {events = 4294951808,
data = 18446675010635464703}, {events = 32767, data = 140737488339840}, {events = 4294951216, data = 18446677553256103935}, {events = 32767,
data = 140737488338480}, {events = 4294944944, data = 72358095719792639}, {events = 0, data = 140737488332912}, {events = 4294951808,
data = 18446678137371656191}, {events = 32767, data = 140733193392005}, {events = 4294945296, data = 158775079688241151}, {events = 0,
data = 140737488332976}, {events = 16837060, data = 158403204239851520}, {events = 0, data = 36965912}, {events = 4294944896,
data = 18446674460879650815}, {events = 32767, data = 140737488339712}, {events = 36965912, data = 18446648622356365312}, {events = 32767,
data = 140737488339248}, {events = 4294945296, data = 17046725230591}, {events = 0, data = 140737488339248}, {events = 11889213,
data = 18446648622356365312}, {events = 32767, data = 11892500}, {events = 36863536, data = 73402296758697984}, {events = 1, data = 140737488333024}, {
events = 6, data = 0}, {events = 0, data = 36863536}, {events = 6, data = 6932845473724104704}, {events = 32513, data = 140737488333328}, {
events = 36881120, data = 158327681534918656}, {events = 0, data = 140737488339264}, {events = 3355, data = 18446675079354908672}, {events = 32767,
data = 140737488333200}, {events = 11892961, data = 18446648965953748992}, {events = 32767, data = 6}, {events = 6, data = 2764277574}, {events = 256,
data = 36863536}, {events = 4294951824, data = 369367220223}, {events = 0, data = 140737488339264}, {events = 3355, data = 18446675079354908672}, {
events = 32767, data = 140737488333216}, {events = 17073464, data = 18446649584429039616}, {events = 32767, data = 16764929}, {events = 36863536,
data = 18446675079354908672}, {events = 32767, data = 2875}, {events = 4294951232, data = 18446649721868025855}, {events = 32767, data = 11892961}, {
events = 4294951088, data = 18446677621975580671}, {events = 32767, data = 140737488339992}, {events = 4294951824, data = 18446677621975580671}, {
events = 32767, data = 11889213}, {events = 4294945424, data = 51077898567712767}, {events = 0, data = 36863536}, {events = 4294951232,
data = 18446649790587469825}, {events = 32767, data = 12}, {events = 0, data = 158327681534918656}, {events = 0, data = 12}, {events = 1189661742,
data = 18446677621975580417}, {events = 32767, data = 36881120}, {events = 36863536, data = 18446675079354908672}, {events = 32767, data = 3391}, {
events = 4294951232, data = 18446650546501746687}, {events = 32767, data = 11892961}, {events = 36863536, data = 51539607552}, {events = 0,
data = 5061911656062255116}, {events = 0, data = 256}, {events = 0, data = 140737488339856}, {events = 86, data = 18446675079354908672}, {
events = 32767, data = 3391}, {events = 4294951232, data = 18446650615221223423}, {events = 32767, data = 17073464}, {events = 4294945648,
data = 72004821774794751}, {events = 0, data = 140737488333680}, {events = 11892961, data = 18446650821379620864}, {events = 32767, data = 7}...}
pe = 0x7fffffffa1d0
e = {events = 1, data = 8}
real_timeout = -1
q =
w =
sigset = {__val = {2, 140737488336432, 0, 6451, 36737776, 36808496, 140737488331200, 7, 0, 0, 0, 0, 0, 36822480, 0, 140737336809392}}
sigmask = 0
base = 655307991
have_signals =
nevents = 0
count = 48
nfds = 1
fd =
op =
i =
PRETTY_FUNCTION = "uv__io_poll"
#7 0x000000000143edd6 in uv_run (loop=0x21d0500 <default_loop_struct>, mode=UV_RUN_DEFAULT) at ../deps/uv/src/unix/core.c:368
timeout =
r = 1
#8 0x000000000122c1bd in node::Start(uv_loop_s
, int, char const* const*, int, char const* const*) ()
No symbol table info available.
#9 0x0000000001224d03 in node::Start(int, char**) ()
No symbol table info available.
#10 0x00007ffff6bd8f45 in __libc_start_main (main=0x8acef0

, argc=8, argv=0x7fffffffe338, init=, fini=,
rtld_fini=, stack_end=0x7fffffffe328) at libc-start.c:287
result =
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 3985235476459678095, 9104920, 140737488347952, 0, 0, -3985235476642928241, -3985250306478577265},
mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x15634d0 <__libc_csu_init>, 0x7fffffffe338}, data = {prev = 0x0, cleanup = 0x0,
canceltype = 22426832}}}
not_first_call =
#11 0x00000000008aee41 in _start ()
No symbol table info available.

@jay11ca39
Copy link
Author

Following are my software version:

  • Node: v8.9.4
  • npm: 5.6.0
  • node-gyp: 3.8.0
  • nan: 2.11.1

@jay11ca39
Copy link
Author

Hello @addaleax and @gireeshpunathil ,
As I shared earlier, there is a strange observation on my subscriber sample:

  1. If, I am creating my subscriber object in sample application like this:

subscriber = new subscriber(ip, port);

Result: It is working fine.

  1. If, I am creating the subscriber object like this

var subscriber = new subscriber(ip, port);

Result: It is crashing after receiving some events.

Here, what I am suspecting is :
garbage collector is collecting subscriber object for destroying in 2nd case because I do not have any
code that is using the subscriber object after creating in sample application.

Can you please provide your opinion on this ?

@jay11ca39
Copy link
Author

Hello @gireeshpunathil ,
Any comment on my observation ?

@gireeshpunathil
Copy link
Member

@jay11ca39 - is this resolved?

@gireeshpunathil
Copy link
Member

inactive, closing

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

No branches or pull requests

3 participants