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

Program terminated with signal SIGABRT, Aborted #210

Open
imxys opened this issue Oct 30, 2019 · 1 comment
Open

Program terminated with signal SIGABRT, Aborted #210

imxys opened this issue Oct 30, 2019 · 1 comment

Comments

@imxys
Copy link

imxys commented Oct 30, 2019

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);
    }
}
@imxys
Copy link
Author

imxys commented Oct 30, 2019

I replace dbus_free() with free() and it works.

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

1 participant