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

Crash when playing last song from queue via bluez-alsa #2148

Open
skidoo23 opened this issue Nov 14, 2024 · 3 comments
Open

Crash when playing last song from queue via bluez-alsa #2148

skidoo23 opened this issue Nov 14, 2024 · 3 comments

Comments

@skidoo23
Copy link
Contributor

Bug report

Describe the bug

MPD quits when playling last song from queue via bluez-alsa to bluetooth headphones. Crash does not happen on generic usb dac. Maybe bluez-alsa issue?

Expected Behavior

Normal operation.

Actual Behavior

See above.

Version

Music Player Daemon 0.24 (v0.23.15-1602-geb1463fd7)
Copyright 2003-2007 Warren Dukes [email protected]
Copyright 2008-2021 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

Storage plugins:
local nfs

Decoder plugins:
[mpg123] mp3
[mad] mp3 mp2
[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
[faad] aac
[mpcdec] mpc
[wavpack] wv
[openmpt] mptm mod s3m xm it 669 amf ams c67 dbm digi dmf dsm dtm far imf ice j2b m15 mdl med mms mt2 mtm nst okt plm psm pt36 ptm sfx sfx2 st26 stk stm stp ult wow gdm mo3 oxm umx xpk ppm mmcmp
[sidplay] sid mus str prg P00
[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 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 dash 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 dvdvideo 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 heic heif hevc hls hnm iamf 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 lc3 libgme 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 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 qoa qoi_pipe r3d rco rcv rcwt 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 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://
[pcm]

Filters:
libsamplerate soxr

Tag plugins:
id3tag

Output plugins:
null fifo pipe alsa httpd snapcast

Encoder plugins:
null vorbis opus lame wave flac

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

Input plugins:
file io_uring archive alsa curl ffmpeg nfs mms

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

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

Other features:
dbus epoll icu inotify systemd tcp un

Configuration

music_directory "/music"
playlist_directory "/playlists"
log_file "/var/log/mpd/mpd.log"
state_file "/var/lib/mpd/state"
user "mpd"
bind_to_address "any"
bind_to_address "/run/mpd/socket"
port "6600"
log_level "default"
auto_update "no"
zeroconf_enabled "yes"
zeroconf_name "Music Player Daemon @ %h"
database {
plugin "simple"
path "/var/lib/mpd/database"
cache_directory "/var/lib/mpd/cache"
compress "yes"
}
input {
plugin "curl"
}
filesystem_charset "UTF-8"
decoder {
plugin "sidplay"
songlength_database "/var/lib/mpd/Songlengths.md5"
default_genre "SID"
kernal "/var/lib/mpd/kernal"
basic "/var/lib/mpd/basic"
filter "true"
}
decoder {
plugin "mad"
enabled "no"
}
decoder {
plugin "mpg123"
enabled "yes"
}
decoder {
plugin "ffmpeg"
enabled "yes"
}
decoder {
plugin "mpcdec"
enabled "yes"
}
audio_output {
type "alsa"
name "U-Control UCA202"
device "plughw:CARD=CODEC,DEV=0"
mixer_type "hardware"
format "*:16:2"
mixer_device "hw:CODEC"
mixer_control "PCM"
}
audio_output {
type "alsa"
name "Sony WH-1000XM4"
device "bluealsa:DEV=00:11:22:33:44:55,PROFILE=a2dp,CODEC=aac"
mixer_type "software"
}
partition {
name "kopfhoerer"
}
decoder {
plugin "dsdiff"
enabled "no"
}
decoder {
plugin "dsf"
enabled "no"
}
decoder {
plugin "fluidsynth"
enabled "no"
}
decoder {
plugin "mikmod"
enabled "no"
}
decoder {
plugin "modplug"
enabled "no"
}
decoder {
plugin "wildmidi"
enabled "no"
}
resampler {
plugin "soxr"
quality "high"
threads "0"
}
neighbors {
plugin "nfs"
}

Log

(gdb) run
Starting program: /usr/bin/mpd --stderr --no-daemon --verbose
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
config_file: loading file "/etc/mpd.conf"
soxr: soxr converter "high"
vorbis: Xiph.Org libVorbis 1.3.7
opus: libopus 1.5.2
sndfile: libsndfile-1.2.2
simple_db: reading DB
curl: version 8.11.0
curl: with GnuTLS/3.8.6
[New Thread 0x7fffe30006c0 (LWP 21829)]
[New Thread 0x7fffe26006c0 (LWP 21830)]
state_file: Loading state file /var/lib/mpd/state
event: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
playlist: play 77:"misc/Nylon Euter - Tommi Brain.mp3"
[New Thread 0x7fffe1c006c0 (LWP 21831)]
[New Thread 0x7fffe12006c0 (LWP 21832)]
[New Thread 0x7fffdbe006c0 (LWP 21833)]
output: OutputThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
decoder_thread: probing plugin mpg123
decoder: audio_format=48000:16:2, seekable=true
client: [0] opened from ?
client: [0] process command list
client: process command "tagtypes "all""
client: command returned 0
client: process command "tagtypes"
client: command returned 0
client: [0] process command list returned 0
client: [0] process command list
client: process command "tagtypes "clear""
client: command returned 0
client: process command "tagtypes enable Artist Album AlbumArtist Title Track Name Genre Date Composer Performer Disc Label Work Conductor"
client: command returned 0
client: [0] process command list returned 0
client: [0] process command "status"
client: [0] command returned 0
client: [0] process command "playlistinfo"
client: [0] command returned 0
client: [0] process command "outputs"
client: [0] command returned 0
client: [0] process command "listpartitions"
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "status"
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "pause "0""
alsa_output: opened "bluealsa:DEV=00:11:22:33:44:55,PROFILE=a2dp,CODEC=aac" type=PLUG
alsa_output: buffer: size=960..206158430 time=20000..4294967292
alsa_output: period: size=480..262144 time=10000..5461334
alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
alsa_output: format=S24_LE (Signed 24 bit Little Endian)
alsa_output: buffer_size=24000 period_size=6000
output: opened "Sony WH-1000XM4" (alsa) audio_format=48000:24:2
output: converting in=48000:16:2 -> f=48000:24:2 -> out=48000:24:2
client: [0] command returned 0
client: [0] process command "idle"
client: [0] command returned 1
client: [0] process command "status"
client: [0] command returned 0
[New Thread 0x7fffdb4006c0 (LWP 21836)]
client: [0] process command "idle"
(...)
alsa_output: opened "bluealsa:DEV=00:11:22:33:44:55,PROFILE=a2dp,CODEC=aac" type=PLUG
alsa_output: buffer: size=960..206158430 time=20000..4294967292
alsa_output: period: size=480..262144 time=10000..5461334
alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
alsa_output: format=S24_LE (Signed 24 bit Little Endian)
alsa_output: buffer_size=24000 period_size=6000
output: opened "Sony WH-1000XM4" (alsa) audio_format=48000:24:2
output: converting in=48000:16:2 -> f=48000:24:2 -> out=48000:24:2
(...)
[Thread 0x7fffdb4006c0 (LWP 21836) exited]
alsa_output: Decoder is too slow; playing silence to avoid xrun
player: played "misc/Nylon Euter - Tommi Brain.mp3"
playlist: stop
output: closed "Sony WH-1000XM4" (alsa)

Thread 6 "output:Sony WH-" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdbe006c0 (LWP 21833)]
0x000055555569b332 in TwoFilters::Reset (this=0x7fffc4000f00)
at ../src/filter/plugins/TwoFilters.hxx:27
27 first->Reset();
(gdb) bt
#0 0x000055555569b332 in TwoFilters::Reset (this=0x7fffc4000f00)
at ../src/filter/plugins/TwoFilters.hxx:27
#1 0x0000555555682011 in AudioOutputSource::Cancel (this=0x555556212f60)
at ../src/output/Source.cxx:74
#2 0x0000555555681f40 in AudioOutputSource::Close (this=0x555556212f60)
at ../src/output/Source.cxx:56
#3 0x00005555556841e1 in AudioOutputControl::InternalClose
(this=0x555556212f30, drain=false) at ../src/output/Thread.cxx:176
#4 0x000055555568367d in AudioOutputControl::Task (this=0x555556212f30)
at ../src/output/Thread.cxx:496
#5 0x000055555567df78 in BindMethodDetail::WrapperGenerator<void (AudioOutputControl::)() noexcept, &AudioOutputControl::Task>::Invoke(void)
(_instance=0x555556212f30) at ../src/util/BindMethod.hxx:102
#6 0x000055555561f9f6 in BoundMethod<void () noexcept>::operator()() const
(this=0x555556212ff8) at ../src/util/BindMethod.hxx:52
#7 0x000055555562af44 in Thread::Run (this=0x555556212ff8)
at ../src/thread/Thread.cxx:53
#8 0x000055555562af25 in Thread::ThreadProc (ctx=0x555556212ff8)
at ../src/thread/Thread.cxx:82
#9 0x00007ffff15b6112 in start_thread (arg=)
at ./nptl/pthread_create.c:447
#10 0x00007ffff16348f8 in __GI___clone3 ()
at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb) quit

@borine
Copy link
Contributor

borine commented Nov 16, 2024

I see the same failure. In the debugger, when it stops at the SEGV, I see that MPD is de-referencing a nullptr:

(gdb) p first
$1 = std::unique_ptr<Filter> = {get() = 0x0}
(gdb) 

... but I have no idea how the pointer got to be null in the first place.

@Galicarnax
Copy link

Galicarnax commented Nov 17, 2024

Facing the same issue - segfault when last track from the queue is finished playing. I also have bluez-alsa, but for me this happens with USB DAC as well.

My mpd --version:

Music Player Daemon 0.24 (v0.23.15-1602-geb1463fd7+)
Copyright 2003-2007 Warren Dukes <[email protected]>
Copyright 2008-2021 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

Storage plugins:
 local


Decoder plugins:
 [mad] mp3 mp2
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [pcm]

Filters:


Tag plugins:
 id3tag

Output plugins:
 null alsa

Input plugins:
 file alsa curl

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

Protocols:
 alsa:// ftp:// ftps:// gopher:// http:// https:// scp:// sftp:// smb://

Other features:
 dbus epoll icu inotify systemd tcp

@borine
Copy link
Contributor

borine commented Nov 17, 2024

The same failure occurs with any ALSA output: it appears to be related to the use of mixer-type "software"

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

3 participants