Skip to content

crash in InputCacheItem::OnBufferAvailable #2455

@balejk

Description

@balejk

Bug report

Describe the bug

When playing opus audio files added from an arbitrary filesystem location using mpc add /... (i. e. not inside music_directory), mpd sometimes crashes when the current track finishes and the next queued track should be played.

I don't know how to reliably reproduce the crash, sometimes it's frequent (i. e. mpd crashes again somewhat soon after it's restarted), sometimes it will not crash for a long time.

I don't recall that mpd would crash when I play files from the library, only when I play these external files, but I'm not at all sure. This may be related to the file format: the external files are usually opus, the library contents are mostly FLACs.

Expected Behavior

mpd doesn't crash and plays the next track in the queue.

Actual Behavior

mpd crashes (SIGSEGV).

Version

Music Player Daemon 0.24.9 (0.24.9)
Copyright 2003-2007 Warren Dukes <[email protected]>
Copyright 2008-2025 Max Kellermann <[email protected]>
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

Decoder plugins:
 [mpg123] mp3
 [mad] mp3 mp2
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [dsdiff] dff
 [dsf] dsf
 [faad] aac
 [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
 [ffmpeg] 264 265 266 302 3g2 3gp 4xm 669 722 aa aa3 aac aax ac3 ac4 ace acm act adf adp ads adx aea afc aif aiff aix al alias_pix alp amf amr amrnb amrwb ams anm ans apc ape apl apm apng aptx aptxhd aqt argo_asf argo_brp argo_cvg art asc asf asf_o ass ast au avc avi avif avr avs avs2 avs3 bcstm bethsoftvid bfi bfstm bin bink binka bit bitpacked bmp_pipe bmv boa bonk brender_pix brstm c2 c93 caf cdata cdg cdxl cgi cif cine codec2raw concat cri_pipe dat data daud dav dbm dds_pipe dfa dff dfpwm dif digi dirac diz dmf dnxhd dpx_pipe dsf dsicin dsm dss dst dtk dtm dts dtshd dv dvbsub dvbtxt dxa ea eac3 ec3 evc exr_pipe f32be f32le f4v f64be f64le fap far ffmetadata film_cpk fits flac flic flm flv frm fsb fwse g722 g723_1 g726 g726le g729 gdm gdv gem_pipe genh gif gif_pipe gsm gxf h261 h263 h264 h265 h266 h26l hca hcom hdr_pipe hevc hls hnm ice ico idcin idf idx iff ifv ilbc image2 image2pipe imf imx ipmovie ipu ircam ism isma ismv iss it iv8 ivf ivr j2b j2k j2k_pipe jacosub jpeg_pipe jpegls_pipe jpegxl_pipe jv jxl kux kvag laf lmlm4 loas lrc lvf lxf m15 m2a m4a m4b m4v mac mca mcc mdl med mgsts microdvd mj2 mjpeg mjpg mk3d mka mks mkv mlp mlv mm mmcmp mmf mms mo3 mod mods moflex mov mp2 mp3 mp4 mpa mpc mpc8 mpeg mpegts mpegtsraw mpegvideo mpl2 mpo mptm msbc msf msnwctcp msp mt2 mtaf mtm mtv musx mv mvi mxf mxg nfo nist nsp nst nsv nut nuv obu ogg okt oma omg opus osq paf pam_pipe pbm_pipe pcx_pipe pdv pfm_pipe pgm_pipe pgmyuv_pipe pgx_pipe phm_pipe photocd_pipe pictor_pipe pjs plm pmp png_pipe pp_bnk ppm ppm_pipe psd_pipe psm psp psxstr pt36 ptm pva pvf qcif qcp qdraw_pipe qoi_pipe r3d rco rcv rgb rka rl2 rm roq rpl rsd rso rt rtp rtsp s16be s24be s24le s32be s32le s337m s3m sami sap sb sbc sbg scc scd sdns sdp sdr2 sds sdx ser sf sfx sfx2 sga sgi_pipe shn sln smi smk smush sol son sox spdif sph srt ss2 st26 stk stl stm stp str sub sunrast_pipe sup svag svg_pipe svs sw swf tak tco tedcaptions thd thp tiertexseq tiff_pipe tmv tta txd txt ty ty+ u16be u24be u24le u32be u32le ub ul ult umx usm uw v v210 vag vb vbn_pipe vc1 vidc viv vividas vmd voc vpk vqe vqf vql vt vtt vvc w64 wa wav way wc3movie webm webm_dash_manifest webp_pipe wma wow wsaud wsd wsvqa wtv wv wve xa xbin xbm_pipe xl xm xmd xmv xpk xpm_pipe xvag xwd_pipe xwma y4m yop yuv yuv10 rtp:// rtsp:// rtsps://
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [audiofile] wav au aiff aif
 [pcm]

Filters:
 libsamplerate soxr

Tag plugins:
 id3tag

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

Encoder plugins:
 null vorbis opus twolame wave flac

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

Input plugins:
 file archive alsa curl ffmpeg nfs mms cdio_paranoia

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

Protocols:
 file:// alsa:// cdda:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://

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

mpd is running on a musl-based Void Linux.

Configuration

music_directory		"~/music"
playlist_directory	"~/.config/mpd/playlists"
db_file			"~/.cache/mpd/database"
log_file			"~/.config/mpd/log"
pid_file			"~/.config/mpd/pid"
state_file			"~/.config/mpd/state"
bind_to_address		"~/.config/mpd/socket"
restore_paused "yes"

input {
        plugin "curl"
}

input_cache {
	size "1 GB"
}

audio_output {
	type		"alsa"
	name		"ALSA"
	mixer_type      "software"
	auto_resample	"no"
}

audio_output {
	type		"httpd"
	name		"HTTP"
}

audio_output {
       type            "pipewire"
       name            "PipeWire"
}

PipeWire is not available on this system and the output is normally disabled, but it was probably enabled during the crash since the previous crash probably enabled it.

Log

Tail of the log:

2026-04-03T14:20:23 player: played "/tmp/previous-track.opus"
2026-04-03T14:20:23 playlist: queue song 7:"/tmp/next-track.opus"
[E] pw.loop [loop.c:70 pw_loop_new()] 0x7f5dcfe6c630: can't make support.system handle: No such file or directory
2026-04-03T14:20:23 exception: Failed to enable output "PipeWire" (pipewire); pw_thread_loop_new() failed: No such file or directory
2026-04-03T14:20:23 cache: Prefetch "/tmp/next-track.opus"

Stacktrace:

Thread 22 "buffering" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 10905]
InputCacheItem::OnBufferAvailable (this=0x7f4f2a7cde30) at ../src/input/cache/Item.cxx:44
warning: 44     ../src/input/cache/Item.cxx: No such file or directory
(gdb) bt
#0  InputCacheItem::OnBufferAvailable (this=0x7f4f2a7cde30) at ../src/input/cache/Item.cxx:44
#1  0x00005612e1bedefe in BufferingInputStream::RunThreadLocked (this=0x7f4f2a7cde30, lock=...)
    at ../src/input/BufferingInputStream.cxx:158
#2  BufferingInputStream::RunThread (this=0x7f4f2a7cde30) at ../src/input/BufferingInputStream.cxx:172
#3  BindMethodDetail::WrapperGenerator<void (BufferingInputStream::*)() noexcept, &BufferingInputStream::RunThread>::Invoke(void*) (_instance=0x7f4f2a7cde30) at ../src/util/BindMethod.hxx:102
#4  0x00005612e1be35dd in BoundMethod<void () noexcept>::operator()() const (this=<optimized out>, 
    this=<optimized out>) at ../src/util/BindMethod.hxx:52
#5  Thread::Run (this=<optimized out>) at ../src/thread/Thread.cxx:53
#6  Thread::ThreadProc (ctx=<optimized out>) at ../src/thread/Thread.cxx:82
#7  0x00007f4f36b0490e in start (p=0x7f4f23bcd5d0) at src/thread/pthread_create.c:207
#8  0x00007f4f36b0ad11 in __clone () at src/thread/x86_64/clone.s:22
Backtrace stopped: frame did not save the PC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions