c++ - node js segfault in Buffer javascript code -
my node app crashing pretty randomly when handling large amount of packets in node extension. when open dropped core file in gdb (node compiled debugging symbols) get:
program terminated signal 11, segmentation fault. #0 0x5e02190a in ?? () (gdb) bt #0 0x5e02190a in ?? () #1 0x5e01316a in ?? () #2 0x08210303 in v8::internal::invoke(bool, v8::internal::handle<v8::internal::jsfunction>, v8::internal::handle<v8::internal::object>, int, v8::internal::handle<v8::internal::object>*, bool*) () #3 0x0821062f in v8::internal::execution::new(v8::internal::handle<v8::internal::jsfunction>, int, v8::internal::handle<v8::internal::object>*, bool*) () #4 0x081bfadd in v8::function::newinstance(int, v8::handle<v8::value>*) const () ...
looking @ source code of c packet handling extension newinstance call node's buffer constructor. here offending fragment of code (packet regular c data structure):
... v8::local<v8::function> bufferconstructor = v8::local<v8::function>::cast(globalobj->get(v8::string::new("buffer"))); v8::handle<v8::value> constructorargs[3] = { slowbuf->handle_, v8::integer::new(packet->packet->datalength), v8::integer::new(0) }; v8::local<v8::object> actualbuffer = bufferconstructor->newinstance(3, constructorargs);
now if understand correctly, buffer source code pure js.
what strategy figure out in js code code crashing , why?
the code running stable days handling thousands of packets @ c level , turning them node buffer objects, crashes same signature time time , i'd understand why...
Comments
Post a Comment