MusicPlayerDaemon / MPD

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

Chunked albumart requests always check previously failed files #1156

Closed vvnull closed 3 years ago

vvnull commented 3 years ago

Bug report

Describe the bug

albumart requests cycle through the supported formats until a file is found: png, jpg, tiff, bmp When chunked, each request for a chunk will cycle through the formats again. Thus, when a cover.jpg file exists but a cover.png does not, each chunk request will first fire a failed request for the specified chunk of the nonexistent cover.png before failing over to cover.jpg. This results in doubling the requests made. If a bmp file were used, I expect it would cause 4x the requests to be issued. Logged below is a cover which was split into 89 chunks, per MPD logs. In a satellite configuration where these requests are served over a network, duplicating requests in this quantity by a factor of 2-4 puts undue strain on the webserver and impedes performance of the client.

Expected Behavior

MPD somehow "remembers" (or otherwise allows specifying) known bad (or good) files when requesting chunked data.

Actual Behavior

Requests for chunks of previously failed files are attempted.

Version

Music Player Daemon 0.22.6 (0.22.6)
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 rtp:// rtsp:// rtsps://
 [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 oss openal pulse jack httpd recorder

Encoder plugins:
 null vorbis opus lame wave flac

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

Input plugins:
 file io_uring 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:// hls+http:// hls+https:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// qobuz:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp:// tidal://

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

Log

MPD log snippet (through syslog):

May 11 22:52:00 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "0""
May 11 22:52:00 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:00 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:00 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "8192""
May 11 22:52:00 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:00 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:00 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "16244""
May 11 22:52:00 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:00 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:00 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "24436""
May 11 22:52:00 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:01 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:01 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "32628""
May 11 22:52:01 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:01 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:01 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "40820""
May 11 22:52:01 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:01 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:01 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "49012""
May 11 22:52:02 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:02 mobian mpd[31004]: client: [0] command returned 0
May 11 22:52:02 mobian mpd[31004]: client: [0] process command "albumart "flac_split/TORIENA/SIXTHSENSE RIOT/01 SIXTHSENSE.flac" "57204""
May 11 22:52:02 mobian mpd[31004]: exception: CURL failed: The requested URL returned error: 404
May 11 22:52:02 mobian mpd[31004]: client: [0] command returned 0

... [repeated for 89 chunks]

Matching webserver logs:

10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 404 153 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 200 707527 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 404 153 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 200 707527 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 404 153 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 200 707527 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.jpg HTTP/2.0" 206 691283 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - - [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 401 179 "-" "Music Player Daemon 0.22.6"
10.10.10.1 - user [11/May/2021:22:52:00 -0400] "GET /Media/Music/flac_split/TORIENA/SIXTHSENSE%20RIOT/cover.png HTTP/2.0" 404 153 "-" "Music Player Daemon 0.22.6"

... [repeated for 89 chunks]

Note the 404s. Please disregard the 401s; they are noted in #1155.

vvnull commented 3 years ago

301 would probably mitigate most of this issue.