Debug a failed node -ffi callback / segmentation error

I try to use libvlc from node.js using node-fffi, and although it is great for the main functions of the main media player, I keep getting crashes, segmentation errors and general freezes in my program when I try to use the asynchronous libvlc event system and integrate her with node EventEmitter. The code I use so far is hosted at https://gist.github.com/2644721 , but does not seem to work.

GDB produces a mixed bag of results, but the last crash I received was:

Program received signal SIGSEGV, Segmentation fault.
0x000000000057cc86 in v8::Function::Call(v8::Handle<v8::Object>, int, v8::Handle<v8::Value>*) ()
(gdb) bt
#0  0x000000000057cc86 in v8::Function::Call(v8::Handle<v8::Object>, int, v8::Handle<v8::Value>*) ()
#1  0x00007ffff5997a41 in CallbackInfo::DispatchToV8(CallbackInfo*, void*, void**) ()
   from /home/adam/node_modules/node-ffi/compiled/0.6/linux/x64/ffi_bindings.node
#2  0x00007ffff5997adb in CallbackInfo::WatcherCallback(uv_async_s*, int) ()
   from /home/adam/node_modules/node-ffi/compiled/0.6/linux/x64/ffi_bindings.node
#3  0x00000000007be12f in ev_invoke_pending ()
#4  0x00000000007c2087 in ev_run ()
#5  0x00000000007b597f in uv_run ()
#6  0x000000000052a147 in node::Start(int, char**) ()
#7  0x00007ffff63ca76d in __libc_start_main ()
   from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000000000524fe5 in _start ()

, - - node -ffi , , - . , , , , , . ...

Program received signal SIGSEGV, Segmentation fault.
IsGlobalObject (this=0x1)
    at /build/buildd/nodejs-0.6.17/deps/v8/src/objects-inl.h:796
796 in /build/buildd/nodejs-0.6.17/deps/v8/src/objects-inl.h
(gdb) bt
#0  IsGlobalObject (this=0x1)
    at /build/buildd/nodejs-0.6.17/deps/v8/src/objects-inl.h:796
#1  v8::internal::Invoke (construct=<optimised out>, func=..., receiver=..., 
    argc=2, args=0x7fffffffdeb0, has_pending_exception=0x7fffffffde1f)
    at /build/buildd/nodejs-0.6.17/deps/v8/src/execution.cc:101
#2  0x00000000005ae967 in v8::internal::Execution::Call (callable=..., 
    receiver=..., argc=2, args=0x7fffffffdeb0, 
    pending_exception=0x7fffffffde1f, convert_receiver=<optimised out>)
    at /build/buildd/nodejs-0.6.17/deps/v8/src/execution.cc:175
#3  0x000000000057cd31 in v8::Function::Call (this=0xc0aae0, recv=..., argc=2, 
    argv=0x7fffffffdeb0) at /build/buildd/nodejs-0.6.17/deps/v8/src/api.cc:3601
#4  0x00007ffff5997a41 in CallbackInfo::DispatchToV8(CallbackInfo*, void*, void**) ()
   from /home/adam/node_modules/node-ffi/compiled/0.6/linux/x64/ffi_bindings.node
#5  0x00007ffff5997adb in CallbackInfo::WatcherCallback(uv_async_s*, int) ()
   from /home/adam/node_modules/node-ffi/compiled/0.6/linux/x64/ffi_bindings.node
#6  0x00000000007be12f in ev_invoke_pending (loop=0xb9dea0)
    at src/unix/ev/ev.c:2149
#7  0x00000000007c2087 in ev_run (loop=0xb9dea0, flags=0)
    at src/unix/ev/ev.c:2525
#8  0x00000000007b597f in uv_run (loop=<optimised out>) at src/unix/core.c:194
+3

All Articles