MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.16k stars 346 forks source link

Assert in LastInputStream::OnCloseTimer #1165

Closed geneticdrift closed 3 years ago

geneticdrift commented 3 years ago

Bug report

Assert assert(is); in LastInputStream::OnCloseTimer when the last open returned null. The close timer is scheduled even if is was null.

  is = open(new_uri, mutex);
  uri = std::forward<U>(new_uri);
  ScheduleClose();
  return is.get();

(also, because there's only one client.last_album_art, concurrent album art commands lose the optimization.)

mpd: ../mpd.my_github.fork/src/input/LastInputStream.cxx:42: void LastInputStream::OnCloseTimer(): Assertion `is' failed.

Thread 1 "mpd" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007ffff2d5e864 in __GI_abort () at abort.c:79
#2  0x00007ffff2d5e749 in __assert_fail_base
    (fmt=0x7ffff2ee7f78 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5555557a9a14 "is", file=0x55555579c050 "../mpd.my_github.fork/src/input/LastInputStream.cxx", line=42, function=<optimized out>) at assert.c:92
#3  0x00007ffff2d703d6 in __GI___assert_fail
    (assertion=0x5555557a9a14 "is", file=0x55555579c050 "../mpd.my_github.fork/src/input/LastInputStream.cxx", line=42, function=0x55555579c028 "void LastInputStream::OnCloseTimer()") at assert.c:101
#4  0x0000555555678397 in LastInputStream::OnCloseTimer() (this=0x555555ab0830) at ../mpd.my_github.fork/src/input/LastInputStream.cxx:42
#5  0x000055555567843c in BindMethodDetail::BindMethodWrapperGenerator2<LastInputStream, true, void (LastInputStream::*)() noexcept, &LastInputStream::OnCloseTimer, void>::Invoke(void*) (_instance=0x555555ab0830) at ../mpd.my_github.fork/src/util/BindMethod.hxx:152
#6  0x00005555556130f8 in BoundMethod<void () noexcept>::operator()() const (this=0x555555ab08a8) at ../mpd.my_github.fork/src/util/BindMethod.hxx:79
#7  0x000055555561dd8e in FineTimerEvent::Run() (this=0x555555ab0880) at ../mpd.my_github.fork/src/event/FineTimerEvent.hxx:114
#8  0x000055555561dd31 in TimerList::Run(std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >)
    (this=0x7fffffffc3c8, now=...) at ../mpd.my_github.fork/src/event/TimerList.cxx:87
#9  0x000055555561ad94 in EventLoop::HandleTimers() (this=0x7fffffffbbe8) at ../mpd.my_github.fork/src/event/Loop.cxx:166
#10 0x0000555555619ea8 in EventLoop::Run() (this=0x7fffffffbbe8) at ../mpd.my_github.fork/src/event/Loop.cxx:296
#11 0x0000555555590c4e in MainConfigured(options const&, ConfigData const&) (options=..., raw_config=...) at ../mpd.my_github.fork/src/Main.cxx:541
#12 0x0000555555591012 in MainOrThrow(int, char**) (argc=5, argv=0x7fffffffda88) at ../mpd.my_github.fork/src/Main.cxx:627
#13 0x00005555555910bf in mpd_main(int, char**) (argc=5, argv=0x7fffffffda88) at ../mpd.my_github.fork/src/Main.cxx:635
#14 0x000055555559114e in main(int, char**) (argc=5, argv=0x7fffffffda88) at ../mpd.my_github.fork/src/Main.cxx:649

Version

Music Player Daemon 0.22~git (v0.21.24-1007-gc6a7f6dab)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy upnp

Storage plugins:
 local smbclient udisks nfs curl

Neighbor plugins:
 smbclient upnp udisks

Decoders plugins:
 [mad] mp3 mp2
 [mpg123] mp3
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [audiofile] wav au aiff aif
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [faad] aac
 [mpcdec] mpc
 [wavpack] wv
 [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
 [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
 [sidplay] sid mus str prg P00
 [wildmidi] mid
 [fluidsynth] mid
 [adplug] amd d00 hsc laa rad raw sa2
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve
 [gme] ay gbs gym hes kss nsf nsfe sap spc vgm vgz
 [pcm]

Filters:
 libsamplerate soxr

Tag plugins:
 id3tag

Output plugins:
 shout null fifo sndio pipe alsa ao openal pulse jack httpd recorder

Encoder plugins:
 null vorbis opus lame twolame wave flac shine

Archive plugins:
 [bz2] bz2
 [zzip] zip
 [iso] iso

Input plugins:
 file archive alsa tidal qobuz curl ffmpeg smbclient nfs mms cdio_paranoia

Playlist plugins:
 extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols:
 file:// alsa:// cdda:// ftp:// ftps:// gopher:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// qobuz:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// scp:// sftp:// smb:// srtp:// tidal://

Other features:
 avahi dbus udisks epoll icu inotify ipv6 systemd tcp un

Log

May 20 11:18 : state_file: Loading state file /home/mpd/mpd_opt/state
May 20 11:18 : config: option 'bitrate' on line 322 was not recognized
May 20 11:18 : client: [0] opened from 127.0.0.1:43026
May 20 11:18 : client: [0] process command "albumart asd 0"
May 20 11:18 : client: [0] command returned 3
mpd: ../src/input/LastInputStream.cxx:42: void LastInputStream::OnCloseTimer(): Assertion `is' failed.
samhh commented 3 years ago

I've started seeing the same today on Arch. I haven't yet been able to discern a pattern to these crashes, but it's happening frequently.

logs ``` May 21 11:51:12 mpd[167085]: mpd: ../src/input/LastInputStream.cxx:42: void LastInputStream::OnCloseTimer(): Assertion `is' failed. May 21 11:51:12 systemd-coredump[210659]: [🡕] Process 167085 (mpd) of user 1000 dumped core. Stack trace of thread 167085: #0 0x00007f5e98663d22 raise (libc.so.6 + 0x3cd22) #1 0x00007f5e9864d862 abort (libc.so.6 + 0x26862) #2 0x00007f5e9864d747 __assert_fail_base.cold (libc.so.6 + 0x26747) #3 0x00007f5e9865c616 __assert_fail (libc.so.6 + 0x35616) #4 0x0000561ccd8d28ee n/a (mpd + 0xa28ee) #5 0x0000561ccd8b2a3c n/a (mpd + 0x82a3c) #6 0x0000561ccd881f13 n/a (mpd + 0x51f13) #7 0x0000561ccd883080 n/a (mpd + 0x53080) #8 0x0000561ccd878e9c n/a (mpd + 0x48e9c) #9 0x00007f5e9864eb25 __libc_start_main (libc.so.6 + 0x27b25) #10 0x0000561ccd87918e n/a (mpd + 0x4918e) Stack trace of thread 167102: #0 0x00007f5e9abfc8ca __futex_abstimed_wait_common64 (libpthread.so.0 + 0x158ca) #1 0x00007f5e9abf6270 pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0 + 0xf270) #2 0x00007f5e98a20f01 __gthread_cond_wait (libstdc++.so.6 + 0xccf01) #3 0x0000561ccd890721 n/a (mpd + 0x60721) #4 0x0000561ccd897355 n/a (mpd + 0x67355) ```
mpd --version ``` Music Player Daemon 0.22.7 (0.22.7) Copyright 2003-2007 Warren Dukes Copyright 2008-2021 Max Kellermann This is free software; see the source for copying conditions. There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Database plugins: simple proxy upnp Storage plugins: local udisks nfs curl Neighbor plugins: upnp udisks Decoders plugins: [mad] mp3 mp2 [mpg123] mp3 [vorbis] ogg oga [oggflac] ogg oga [flac] flac [opus] opus ogg oga [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2 [audiofile] wav au aiff aif [dsdiff] dff [dsf] dsf [hybrid_dsd] m4a [faad] aac [mpcdec] mpc [wavpack] wv [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm [sidplay] sid mus str prg P00 [wildmidi] mid [fluidsynth] mid [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps:// [gme] ay gbs gym hes kss nsf nsfe rsn sap spc vgm vgz [pcm] Filters: libsamplerate soxr Tag plugins: id3tag Output plugins: shout null fifo pipe alsa ao oss openal solaris pulse jack httpd recorder Encoder plugins: null vorbis opus lame twolame wave flac Archive plugins: [bz2] bz2 [zzip] zip [iso] iso Input plugins: file io_uring archive alsa tidal qobuz curl ffmpeg nfs mms cdio_paranoia Playlist plugins: extm3u m3u pls xspf asx rss soundcloud flac cue embcue Protocols: file:// alsa:// cdda:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// qobuz:// rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp:// tidal:// Other features: avahi dbus udisks epoll icu inotify ipv6 systemd tcp un ```