Waybar: SIGABRT in `MPD::checkErrors()`

Created on 22 Apr 2019  路  6Comments  路  Source: Alexays/Waybar

I'm back again, but no solid STR this time. I'll post a reply if I do find something.


After some time (this one actually takes a fairly long while compared to our last two issues), Waybar receives a SIGABRT from libmpdclient, due to a failed assertion: waybar: ../src/ierror.h:130: mpd_error_get_message: Assertion 'error->message != NULL || error->code == MPD_ERROR_OOM' failed.


Backtrace

#0  0x00007ffff5dddd7f in raise () at /usr/lib/libc.so.6
#1  0x00007ffff5dc8672 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff5dc8548 in _nl_load_domain.cold.0 () at /usr/lib/libc.so.6
#3  0x00007ffff5dd6396 in  () at /usr/lib/libc.so.6
#4  0x00007ffff62c60d1 in  () at /usr/lib/libmpdclient.so.2
#5  0x00005555555f8ee4 in waybar::modules::MPD::checkErrors(mpd_connection*) (this=0x5555557ac000, conn=0x7fffd8000b60) at ../src/modules/mpd.cpp:284
#6  0x00005555555f9053 in waybar::modules::MPD::fetchState() (this=0x5555557ac000) at ../src/modules/mpd.cpp:293
#7  0x00005555555f61f6 in waybar::modules::MPD::update() (this=0x5555557ac000) at ../src/modules/mpd.cpp:49
#8  0x00005555555b08d1 in waybar::Bar::<lambda()>::operator()(void) const (__closure=0x55555585bc30) at ../src/bar.cpp:194
#9  0x00005555555b170e in sigc::adaptor_functor<waybar::Bar::getModules(const waybar::Factory&, const string&)::<lambda()> >::operator()(void) const (this=0x55555585bc30) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:256
#10 0x00005555555b15b5 in sigc::internal::slot_call0<waybar::Bar::getModules(const waybar::Factory&, const string&)::<lambda()>, void>::call_it(sigc::internal::slot_rep *) (rep=0x55555585bc00) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:136
#11 0x00007ffff751edea in Glib::DispatchNotifier::pipe_io_handler(Glib::IOCondition) () at /usr/lib/libglibmm-2.4.so.1
#12 0x00007ffff7520ecc in Glib::IOSource::dispatch(sigc::slot_base*) () at /usr/lib/libglibmm-2.4.so.1
#13 0x00007ffff75210cf in Glib::Source::dispatch_vfunc(_GSource*, int (*)(void*), void*) () at /usr/lib/libglibmm-2.4.so.1
#14 0x00007ffff69f8661 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#15 0x00007ffff69fa739 in  () at /usr/lib/libglib-2.0.so.0
#16 0x00007ffff69fa77e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#17 0x00007ffff6bb2f5e in g_application_run () at /usr/lib/libgio-2.0.so.0
#18 0x00005555555b621d in waybar::Client::main(int, char**) (this=0x5555556bc8a0, argc=1, argv=0x7fffffffe208) at ../src/client.cpp:258
#19 0x00005555555add3f in main(int, char**) (argc=1, argv=0x7fffffffe208) at ../src/main.cpp:22

Commenting out the auto error_message = mpd_connection_get_error_message(conn); line leads to another abort up in MPD::fetchState(): waybar: ../src/run.c:40: mpd_run_check: Assertion 'connection != NULL' failed.


Backtrace

#0  0x00007ffff5dddd7f in raise () at /usr/lib/libc.so.6
#1  0x00007ffff5dc8672 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff5dc8548 in _nl_load_domain.cold.0 () at /usr/lib/libc.so.6
#3  0x00007ffff5dd6396 in  () at /usr/lib/libc.so.6
#4  0x00007ffff62c1886 in  () at /usr/lib/libmpdclient.so.2
#5  0x00007ffff62c91a9 in mpd_run_status () at /usr/lib/libmpdclient.so.2
#6  0x00005555555f8fe4 in waybar::modules::MPD::fetchState() (this=0x555555768150) at ../src/modules/mpd.cpp:292
#7  0x00005555555f61e6 in waybar::modules::MPD::update() (this=0x555555768150) at ../src/modules/mpd.cpp:49
#8  0x00005555555b08c1 in waybar::Bar::<lambda()>::operator()(void) const (__closure=0x55555588b0d0) at ../src/bar.cpp:194
#9  0x00005555555b16fe in sigc::adaptor_functor<waybar::Bar::getModules(const waybar::Factory&, const string&)::<lambda()> >::operator()(void) const (this=0x55555588b0d0) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:256
#10 0x00005555555b15a5 in sigc::internal::slot_call0<waybar::Bar::getModules(const waybar::Factory&, const string&)::<lambda()>, void>::call_it(sigc::internal::slot_rep *) (rep=0x55555588b0a0) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:136
#11 0x00007ffff751edea in Glib::DispatchNotifier::pipe_io_handler(Glib::IOCondition) () at /usr/lib/libglibmm-2.4.so.1
#12 0x00007ffff7520ecc in Glib::IOSource::dispatch(sigc::slot_base*) () at /usr/lib/libglibmm-2.4.so.1
#13 0x00007ffff75210cf in Glib::Source::dispatch_vfunc(_GSource*, int (*)(void*), void*) () at /usr/lib/libglibmm-2.4.so.1
#14 0x00007ffff69f8661 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#15 0x00007ffff69fa739 in  () at /usr/lib/libglib-2.0.so.0
#16 0x00007ffff69fa77e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#17 0x00007ffff6bb2f5e in g_application_run () at /usr/lib/libgio-2.0.so.0
#18 0x00005555555b620d in waybar::Client::main(int, char**) (this=0x5555556bc8a0, argc=1, argv=0x7fffffffe208) at ../src/client.cpp:258
#19 0x00005555555add2f in main(int, char**) (argc=1, argv=0x7fffffffe208) at ../src/main.cpp:22

Looks like we need more NULL handling. Sorry to do this to you again, but cc: @minijackson

EDIT: Got a new one after I commented out the auto error_message line again. waybar: ../src/async.c:273: mpd_async_io: Assertion '!mpd_error_is_defined(&async->error)' failed.


Backtrace

#0  0x00007ffff5dddd7f in raise () at /usr/lib/libc.so.6
#1  0x00007ffff5dc8672 in abort () at /usr/lib/libc.so.6
#2  0x00007ffff5dc8548 in _nl_load_domain.cold.0 () at /usr/lib/libc.so.6
#3  0x00007ffff5dd6396 in  () at /usr/lib/libc.so.6
#4  0x00007ffff62c705d in mpd_async_io () at /usr/lib/libmpdclient.so.2
#5  0x00007ffff62c8a2c in  () at /usr/lib/libmpdclient.so.2
#6  0x00007ffff62c8bb8 in mpd_send_command () at /usr/lib/libmpdclient.so.2
#7  0x00007ffff62c91b6 in mpd_run_status () at /usr/lib/libmpdclient.so.2
#8  0x00005555555f9004 in waybar::modules::MPD::fetchState() (this=0x5555557f9a20) at ../src/modules/mpd.cpp:292
#9  0x00005555555f61f6 in waybar::modules::MPD::update() (this=0x5555557f9a20) at ../src/modules/mpd.cpp:49
#10 0x00005555555b08d1 in waybar::Bar::<lambda()>::operator()(void) const (__closure=0x555555853000) at ../src/bar.cpp:194
#11 0x00005555555b170e in sigc::adaptor_functor<waybar::Bar::getModules(const waybar::Factory&, const string&)::<lambda()> >::operator()(void) const (this=0x555555853000) at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:256
#12 0x00005555555b15b5 in sigc::internal::slot_call0<waybar::Bar::getModules(const waybar::Factory&, const string&)::<lambda()>, void>::call_it(sigc::internal::slot_rep *) (rep=0x555555852fd0) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:136
#13 0x00007ffff751edea in Glib::DispatchNotifier::pipe_io_handler(Glib::IOCondition) () at /usr/lib/libglibmm-2.4.so.1
#14 0x00007ffff7520ecc in Glib::IOSource::dispatch(sigc::slot_base*) () at /usr/lib/libglibmm-2.4.so.1
#15 0x00007ffff75210cf in Glib::Source::dispatch_vfunc(_GSource*, int (*)(void*), void*) () at /usr/lib/libglibmm-2.4.so.1
#16 0x00007ffff69f8661 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#17 0x00007ffff69fa739 in  () at /usr/lib/libglib-2.0.so.0
#18 0x00007ffff69fa77e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#19 0x00007ffff6bb2f5e in g_application_run () at /usr/lib/libgio-2.0.so.0
#20 0x00005555555b621d in waybar::Client::main(int, char**) (this=0x5555556bc8a0, argc=1, argv=0x7fffffffe208) at ../src/client.cpp:258
#21 0x00005555555add3f in main(int, char**) (argc=1, argv=0x7fffffffe208) at ../src/main.cpp:22

bug

Most helpful comment

Although I haven't seen it SIGABRT while paused/stopped, that's not to say it couldn't happen (being unfamiliar with the codebase). But all the times it has happened to me has been while playing.

All 6 comments

Also @minijackson any reason for not using sleeper_thread?
https://github.com/Alexays/Waybar/blob/0d0f5ed7db16e13ff96361f56faaa0dc7f4e95e9/src/modules/mpd.cpp#L63

sleeper_thread manages well the case when a bar closes in case of several screens

Damn, I just keep writing bad code x)
No worries about tagging me, I'm the one who created this mess :p

My first intuition is that it might be bad lock on scheduling (which might explain why it takes a long time):

  • The event listener times out
  • Check error is called
  • While this is happening, in another update, Check error is called
  • The event listener's check error reset the connection
  • The update's check error gets its pointer reset while it's checking errors
  • bam

So, for this theory to be true, we need a checkError that resets the connection without locking the connection mutex, and another checkError happening at the same time.

Then the question is: can this SIGABRT happen while leaving the music paused/stopped and doing nothing? If it can, then it's probably not that.

@Alexays That's a good question, I think it's because I changed many times the implementation, and then forgot about it. I'll see about refactoring the module. But I'm not sure about what you mean by "manages well the case when a bar closes in case of several screens"

@minijackson when the module will be destroyed the thread will remains active since it have been detached.

Although I haven't seen it SIGABRT while paused/stopped, that's not to say it couldn't happen (being unfamiliar with the codebase). But all the times it has happened to me has been while playing.

I've been running Waybar v0.8.0-52-g0ac05cf (Oct 15 2019, branch 'master') (which includes #467) for a while with no issues, though I haven't been listening to as much music as I once had. I'm going to close this issue, but if anybody else is still encountering this issue, please leave a comment here and I'll reopen it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atomheartother picture atomheartother  路  3Comments

GeoDerp picture GeoDerp  路  5Comments

ddorstijn picture ddorstijn  路  5Comments

spjz picture spjz  路  4Comments

AlexChalk picture AlexChalk  路  4Comments