node-dbus
node-dbus copied to clipboard
Program terminated with signal SIGABRT, Aborted
I'm using node-dbus on platform Hi3559. I tried DBus 1.13.7 and 1.10.26. Node version is 8.15.0 . Error info lists below:
Core was generated by `node app.js'.
Program terminated with signal SIGABRT, Aborted.
#0 0x0000007f860ea9ec in raise () from /lib64/libc.so.6
[Current thread is 1 (LWP 16133)]
(gdb) bt
#0 0x0000007f860ea9ec in raise () from /lib64/libc.so.6
#1 0x0000007f860ebde4 in abort () from /lib64/libc.so.6
#2 0x0000007f838c97cc in _dbus_abort () at /home/xys/my-projects/dbus/dbus/dbus-sysdeps.c:91
#3 0x0000007f838b2018 in _dbus_real_assert (condition=0, condition_text=0x7f838e88e0 "old_value >= 1", file=0x7f838e84c8 "/home/xys/my-projects/dbus/dbus/dbus-memory.c", line=734, func=0x7f838e8988 <__func__.4966> "dbus_free")
at /home/xys/my-projects/dbus/dbus/dbus-internals.c:963
#4 0x0000007f838bb68c in dbus_free (memory=0x1768940) at /home/xys/my-projects/dbus/dbus/dbus-memory.c:734
#5 0x0000007f83fa9ca4 in Signal::EmitSignal (info=...) at ../src/signal.cc:130
#6 0x0000007f83fa5a90 in Nan::imp::FunctionCallbackWrapper (info=...) at ../node_modules/nan/nan_callbacks_12_inl.h:176
#7 0x0000000000963b54 in v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) ()
#8 0x00000000009cf7e4 in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) ()
#9 0x00000000009cff04 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
Seems the code calls dbus_free() to free memory alloced by strdup() .
caller code:
// src/signal.cc Line 83
// Create a signal
char* path = strdup(*String::Utf8Value(
v8::Isolate::GetCurrent(),
info[1]->ToString(Nan::GetCurrentContext()).ToLocalChecked()));
// Line 130
dbus_free(path);
dbus code:
/**
* Frees a block of memory previously allocated by dbus_malloc() or
* dbus_malloc0(). If passed #NULL, does nothing.
*
* @param memory block to be freed
*/
void
dbus_free (void *memory)
{
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
if (guards)
{
check_guards (memory, TRUE);
if (memory)
{
#ifdef DBUS_DISABLE_ASSERT
_dbus_atomic_dec (&n_blocks_outstanding);
#else
dbus_int32_t old_value;
old_value = _dbus_atomic_dec (&n_blocks_outstanding);
_dbus_assert (old_value >= 1);
#endif
free (((unsigned char*)memory) - GUARD_START_OFFSET);
}
return;
}
#endif
if (memory) /* we guarantee it's safe to free (NULL) */
{
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#ifdef DBUS_DISABLE_ASSERT
_dbus_atomic_dec (&n_blocks_outstanding);
#else
dbus_int32_t old_value;
old_value = _dbus_atomic_dec (&n_blocks_outstanding);
_dbus_assert (old_value >= 1); // dbus-memory.c: Line 734
#endif
#endif
free (memory);
}
}
I replace dbus_free() with free() and it works.