boysetsfrog / vimpc

Official repository for vimpc a vi/vim inspired client for the Music Player Daemon (mpd). Pull requests are welcome.
GNU General Public License v3.0
266 stars 34 forks source link

vimpc instantly crashing when mpd playing online radio #26

Closed AloisJanicek closed 10 years ago

AloisJanicek commented 10 years ago

When mpd playing online radio stream (added with mpc), vimpc instantly crash, saying

 terminate called after throwing an instance of 'std::logic_error'
 what (): basic_string::_S_construct null not valid
 [1] 22475 abort (core dumped) vimpc

I am using stable archlinux and vimpc-git. This behavior was not present, when I was using vimpc 0.08.1-1 . I can provide some additional info, if you guide me.

boysetsfrog commented 10 years ago

Hello. I am probably not going to get a chance to look at this for a few days but if you want you can run vimpc in gdb "gdb ./vimpc" and then when it crashes do a "thread apply all bt" to get a stack trace of each thread. Based on the error you have pasted it looks as though it is trying to make a string from a null pointer so it should be a relatively easy thing for me to look at, verify and fix.

Thanks

AloisJanicek commented 10 years ago

Here is output (my first time with gdb :-) )

terminate called after throwing an instance of 'std::logic_error'                                                                                             1/191 -- Top
                                                                   what():  basic_string::_S_construct null not valid

Program received signal SIGABRT, Aborted.
0x00007ffff66493d9 in raise () from /usr/lib/libc.so.6
(gdb) 
(gdb) thread apply all bt

Thread 3 (Thread 0x7ffff5bfc700 (LWP 11506)):
#0  0x00007ffff69cb3e8 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from /usr/lib/libpthread.so.0
#1  0x000000000042b75b in __gthread_cond_timedwait (__abs_timeout=0x7ffff5bfbeb0, 
    __mutex=<optimized out>, __cond=0x6be5e0 <Condition>)
    at /usr/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/gthr-default.h:871
#2  __wait_until_impl<std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (
    __atime=..., __lock=..., this=0x6be5e0 <Condition>)
    at /usr/include/c++/4.8.2/condition_variable:160
#3  wait_until<std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (
    __atime=..., __lock=..., this=0x6be5e0 <Condition>)
    at /usr/include/c++/4.8.2/condition_variable:100
#4  wait_for<long, std::ratio<1l, 1000l> > (__rtime=..., __lock=..., 
    this=0x6be5e0 <Condition>) at /usr/include/c++/4.8.2/condition_variable:132
#5  ConditionWait<std::mutex> (TimeoutMs=250, Lock=..., Condition=...)
    at src/compiler.hpp:68
#6  Mpc::Client::ClientQueueExecutor (this=0x7fffffffd9d8, client=<optimized out>)
    at src/mpdclient.cpp:1909
#7  0x00007ffff71a7d30 in ?? () from /usr/lib/libstdc++.so.6
#8  0x00007ffff69c70a2 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007ffff66f949d in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7ffff63fd700 (LWP 11505)):
#0  0x00007ffff66f09dd in poll () from /usr/lib/libc.so.6
#1  0x000000000042f3a4 in QueueInput (inputWindow=0x7c0fa0) at src/screen.cpp:130
#2  0x00007ffff71a7d30 in ?? () from /usr/lib/libstdc++.so.6
#3  0x00007ffff69c70a2 in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007ffff66f949d in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7ffff7fcc740 (LWP 11501)):
#0  0x00007ffff66493d9 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff664a7d8 in abort () from /usr/lib/libc.so.6
#2  0x00007ffff7156af5 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/libstdc++.so.6
#3  0x00007ffff7154c66 in ?? () from /usr/lib/libstdc++.so.6
#4  0x00007ffff7154c93 in std::terminate() () from /usr/lib/libstdc++.so.6
#5  0x00007ffff7154ebe in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x00007ffff71a6467 in std::__throw_logic_error(char const*) ()
   from /usr/lib/libstdc++.so.6
#7  0x00007ffff71b1cb1 in char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) ()
   from /usr/lib/libstdc++.so.6
---Type <return> to continue, or q <return> to quit---
#8  0x00007ffff71b2048 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) ()
   from /usr/lib/libstdc++.so.6
#9  0x0000000000418b3c in Mpc::ClientState::DisplaySongInformation (
    this=0x7fffffffda88) at src/clientstate.cpp:308
#10 0x000000000044d169 in operator() (__args#0=..., this=0x7fffffffd580)
    at /usr/include/c++/4.8.2/functional:2464
#11 Main::Vimpc::Run (this=this@entry=0x7fffffffd830, hostname="", 
    port=port@entry=0) at src/vimpc.cpp:194
#12 0x0000000000407dff in main (argc=1, argv=0x7fffffffdc68) at src/main.cpp:121
(gdb) 
boysetsfrog commented 10 years ago

I haven't had a chance to try and replicate the issue yet, but based on the information you gave me, I think I know what the problem is and i have made a small modification. If you want you can pull the head to the latest commit and try it and let me know if it helps.

Thanks a lot of the backtrace.

AloisJanicek commented 10 years ago

Issue is gone, You did it :+1: Thank You.

boysetsfrog commented 10 years ago

It's no problem. Happy to help.