MusicPlayerDaemon / MPD

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

Update of DB failes while importing #1460

Closed taschenlampe closed 2 years ago

taschenlampe commented 2 years ago

Expected Behavior

-> Update Database

Actual Behavior

-> Updates Database until import failes when importing a certain mp3 files.

Version

Music Player Daemon 0.23.5 (0.23.5)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2021 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
 [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
 [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
 [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 openal solaris pipewire pulse jack httpd snapcast recorder

Encoder plugins:
 null vorbis opus lame twolame wave flac shine

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

Input plugins:
 file io_uring archive alsa qobuz curl ffmpeg smbclient 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:// qobuz:// rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://

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

Log

update: reading SONG.mp3
                                                                                                                                                                                                                                                                                                                         Thread 4 "update" received signal SIGSEGV, Segmentation fault.                                                                                                                                 [Switching to Thread 0x7fffeb8ea640 (LWP 3762)]                                                                                                                                                id3_ucs4_length (ucs4=ucs4@entry=0x0) at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/ucs4.c:42                                                                                                  42        while (*ptr)                                                                                                                                                                         (
(gdb) bt                                                                                                                                                                                      
 #0  id3_ucs4_length (ucs4=ucs4@entry=0x0)                                                                                                                                                          at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/ucs4.c:42                                                                                                                                    #1  0x00007ffff5c4a580 in id3_compat_fixup (tag=tag@entry=0x7fffe023e540)                                                                                                                          at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/build/compat.gperf:240                                                                                                                       #2  0x00007ffff5c4c9a0 in v2_parse (ptr=<optimized out>)                                                                                                                                           at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/tag.c:609                                                                                                                                    #3  id3_tag_parse (length=<optimized out>, data=<optimized out>)                                                                                                                                   at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/tag.c:661                                                                                                                                    #4  id3_tag_parse (data=<optimized out>, length=<optimized out>)                                                                                                                                   at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/tag.c:629                                                                                                                                    #5  0x000055555563217a in MadDecoder::ParseId3(unsigned long, Tag*)                                                                                                                                (mpd_tag=0x0, tagsize=2069, this=0x7fffeb8d6800)                                                                                                                                               at ../src/decoder/plugins/MadDecoderPlugin.cxx:298                                                                                                                                         #6  MadDecoder::DecodeNextFrame(bool, Tag*)                                                                                                                                                        (this=this@entry=0x7fffeb8d6800, skip=skip@entry=false, tag=tag@entry=0x0)                                                                                                                     at ../src/decoder/plugins/MadDecoderPlugin.cxx:382                                                                                                                                         #7  0x0000555555637473 in MadDecoder::DecodeFirstFrame(Tag*)                                                                                                                                       (this=this@entry=0x7fffeb8d6800, tag=tag@entry=0x0)                                                                                                                                            at ../src/decoder/plugins/MadDecoderPlugin.cxx:673                                                                                                                                         #8  0x0000555555637c86 in MadDecoder::RunScan(TagHandler&) (handler=..., this=0x7fffeb8d6800)                                                                                                      at ../src/decoder/plugins/MadDecoderPlugin.cxx:975                                                                                                                                         #9  mad_decoder_scan_stream(InputStream&, TagHandler&) (is=<optimized out>, handler=...)                                                                                                           at ../src/decoder/plugins/MadDecoderPlugin.cxx:995                                                                                                                                         #10 0x00005555555cec72 in DecoderPlugin::ScanStream(InputStream&, TagHandler&) const                                                                                                               (handler=<optimized out>, is=<optimized out>, this=0x5555556edd00 <mad_decoder_plugin>)                                                                                                        at ../src/decoder/DecoderPlugin.hxx:235                                                                                                                                                    #11 TagFileScan::ScanStream(DecoderPlugin const&) (plugin=..., this=0x7fffeb8e85d0)                                                                                                                at ../src/TagFile.cxx:64                                                                                                                                                                   #12 TagFileScan::Scan(DecoderPlugin const&) (plugin=..., this=0x7fffeb8e85d0)                                                                                                                      at ../src/TagFile.cxx:69 
#12 TagFileScan::Scan(DecoderPlugin const&) (plugin=..., this=0x7fffeb8e85d0)                                                                                                                      at ../src/TagFile.cxx:69
#13 TagFileScan::Scan(DecoderPlugin const&) (plugin=..., this=0x7fffeb8e85d0)                       at ../src/TagFile.cxx:67
 #14 operator() (plugin=..., __closure=<synthetic pointer>) at ../src/TagFile.cxx:88             
#15 decoder_plugins_try<ScanFileTagsNoGeneric(Path, TagHandler&)::<lambda(const DecoderPlugin&)> > (f=...) at ../src/decoder/DecoderList.hxx:72 
#16 ScanFileTagsNoGeneric(Path, TagHandler&) (path_fs=..., handler=<optimized out>)                 at ../src/TagFile.cxx:87
#17 0x00005555555cf90b in ScanFileTagsWithGeneric(Path, TagBuilder&, AudioFormat*)                  (audio_format=0x7fffeb8e8698, builder=..., path=...) at ../src/TagFile.cxx:98               
#18 Song::UpdateFile(Storage&) (this=0x7fffe0244a00, storage=<optimized out>)                       at ../src/SongUpdate.cxx:90
#19 0x0000555555646afc in Song::LoadFile(Storage&, char const*, Directory&)                         (parent=..., path_utf8=0x7fffe023f690 "00 - Monster Hospital [Metric].mp3", storage=...)        at ../src/SongUpdate.cxx:59
#20 UpdateWalk::UpdateSongFile2(Directory&, char const*, std::basic_string_view<char, std::char_traits<char> >, StorageFileInfo const&)Python Exception <class 'gdb.error'>: value has been op timized out                                          (info=<optimized out>, suffix=, name=<optimized out>, directory=..., this=0x5555557389a0)       at ../src/db/update/UpdateSong.cxx:66
#21 UpdateWalk::UpdateSongFile(Directory&, char const*, std::basic_string_view<char, std::char_traits<char> >, StorageFileInfo const&)Python Exception <class 'gdb.error'>: value has been opt imized out                                           (info=<optimized out>, suffix=, name=<optimized out>, directory=..., this=0x5555557389a0)   --Type <RET> for more, q to quit, c to continue without paging--                                    at ../src/db/update/UpdateSong.cxx:108 
#22 UpdateWalk::UpdateRegularFile(Directory&, char const*, StorageFileInfo const&)                  (info=<optimized out>, name=<optimized out>, directory=..., this=0x5555557389a0)                at ../src/db/update/Walk.cxx:195
#23 UpdateWalk::UpdateDirectoryChild(Directory&, ExcludeList const&, char const*, StorageFileInfo const&)     (this=0x5555557389a0, directory=..., exclude_list=<optimized out>, name=<optimized out>, info=<optimized out>) at ../src/db/update/Walk.cxx:208
#24 0x0000555555645843 in UpdateWalk::UpdateDirectory(Directory&, ExcludeList const&, StorageFileInfo const&) (this=<optimized out>, directory=..., exclude_list=<optimized out>, info=...)     at ../src/db/update/Walk.cxx:385 
#25 0x0000555555645d71 in UpdateWalk::UpdateDirectoryChild(Directory&, ExcludeList const&, char const*, StorageFileInfo const&)     (this=0x5555557389a0, directory=..., exclude_list=..., name=0x7fffe023eba0 "Other", info=...) at ../src/db/update/Walk.cxx:222
#26 0x0000555555645843 in UpdateWalk::UpdateDirectory(Directory&, ExcludeList const&, StorageFileInfo const&) (this=<optimized out>, directory=..., exclude_list=<optimized out>, info=...)     at ../src/db/update/Walk.cxx:385
#27 0x0000555555645d71 in UpdateWalk::UpdateDirectoryChild(Directory&, ExcludeList const&, char const*, StorageFileInfo const&)     (this=0x5555557389a0, directory=..., exclude_list=..., name=0x7fffe022e990 "Metric", info=...) at ../src/db/update/Walk.cxx:222
#28 0x0000555555645843 in UpdateWalk::UpdateDirectory(Directory&, ExcludeList const&, StorageFileInfo const&) (this=<optimized out>, directory=..., exclude_list=<optimized out>, info=...)     at ../src/db/update/Walk.cxx:385
#29 0x0000555555645d71 in UpdateWalk::UpdateDirectoryChild(Directory&, ExcludeList const&, char const*, StorageFileInfo const&)     (this=0x5555557389a0, directory=..., exclude_list=..., name=0x7fffe0000bd8 "Indie", info=...) at ../src/db/update/Walk.cxx:222
#30 0x0000555555645843 in UpdateWalk::UpdateDirectory(Directory&, ExcludeList const&, StorageFileInfo const&) (this=<optimized out>, directory=..., exclude_list=<optimized out>, info=...)     at ../src/db/update/Walk.cxx:385
#31 0x0000555555648b6e in UpdateWalk::Walk(Directory&, char const*, bool)                           (discard=<optimized out>, path=0x5555557a1cc0 "", root=..., this=0x5555557389a0)                at ../src/db/update/Walk.cxx:529
#32 UpdateService::Task() (this=0x5555557a1c10) at ../src/db/update/Service.cxx:122             
#33 0x00005555555e4ce3 in BoundMethod<void () noexcept>::operator()() const                         (this=0x5555557a1c60) at ../src/util/BindMethod.hxx:78
#34 Thread::Run() (this=0x5555557a1c60) at ../src/thread/Thread.cxx:63
#35 Thread::ThreadProc(void*) (ctx=0x5555557a1c60) at ../src/thread/Thread.cxx:92
#36 0x00007ffff484a2ba in start_thread (arg=<optimized out>) at pthread_create.c:442 #37 0x00007ffff48d4440 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
MaxKellermann commented 2 years ago

Can you upload that file?

taschenlampe commented 2 years ago

Sorry...I just see now that the output/log is horribly formatted, my apologies!

MaxKellermann commented 2 years ago

-> This should be it https://easyupload.io/o22962

HTTP request sent, awaiting response... 403 Forbidden

MaxKellermann commented 2 years ago
HTTP request sent, awaiting response... 200 OK
Length: 331638 (324K) [text/html]

That's ... 324 kB of HTML.

taschenlampe commented 2 years ago

Ok...this log/output should be better to read https://justpaste.it/37o2c

MaxKellermann commented 2 years ago

I don't need another log, I need the file. You link gives me only a HTML file.

taschenlampe commented 2 years ago

Sorry...I feel super stupid :-D This link must work

MaxKellermann commented 2 years ago

Sorry...I feel super stupid :-D This link must work

Connecting to power.ddnss.org (power.ddnss.org)|93.104.93.74|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22020 (22K) [text/html]

HTML again

ranperry commented 2 years ago

Use this:

https://power.ddnss.org/s/NNPaGW8ejnHyjSS/download/00%20-%20Monster%20Hospital%20%5BMetric%5D.mp3

On Tue, Feb 22, 2022 at 1:03 PM Max Kellermann @.***> wrote:

Sorry...I feel super stupid :-D This link https://power.ddnss.org/s/NNPaGW8ejnHyjSS must work

Connecting to power.ddnss.org (power.ddnss.org)|93.104.93.74|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 22020 (22K) [text/html]

HTML again

— Reply to this email directly, view it on GitHub https://github.com/MusicPlayerDaemon/MPD/issues/1460#issuecomment-1048068651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH3E4VTZWFUVUL2LDIZV6LU4PFXTANCNFSM5PB2QTRA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

MaxKellermann commented 2 years ago

Thanks @ranperry, that URL works. I can't reproduce the problem with that file, but I tried to check the backtrace; it shows a crash in id3_ucs4_length(), but MPD never calls that function. The second backtrace shows where it's called:

#0  id3_ucs4_length (ucs4=ucs4@entry=0x0)
    at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/ucs4.c:42
#1  0x00007ffff5c4a580 in id3_compat_fixup (tag=tag@entry=0x7fffe023e540)
    at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/build/compat.gperf:240
#2  0x00007ffff5c4c9a0 in v2_parse (ptr=<optimized out>)
    at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/tag.c:609
#3  id3_tag_parse (length=<optimized out>, data=<optimized out>)
    at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/tag.c:661
#4  id3_tag_parse (data=<optimized out>, length=<optimized out>)
    at /usr/src/debug/libid3tag-0.16.1-1.2.x86_64/tag.c:629
#5  0x000055555563217a in MadDecoder::ParseId3(unsigned long, Tag*)

This is a crash deep inside libid3tag, so it's a libid3tag bug.

What puzzled me was the libid3tag version number. Version 0.16.1 - that's strange, because the latest version is 0.15.1b, released 18 years ago: https://sourceforge.net/projects/mad/files/libid3tag/

So whatever you're using, it's not libid3tag. And it's buggy.

skidoo23 commented 2 years ago

Maybe taschenlampe uses https://github.com/tenacityteam/libid3tag - seems to be a know issue https://github.com/tenacityteam/libid3tag/issues/6

taschenlampe commented 2 years ago

@all: Thanks for looking into that issue. Just a little note about libid3tag, I currently use version 0.16.1-1.2 that is "officially" provided by Opensuse TW (main repo oss).
This lib got updated 2022-01-10, and my last DB-update was earlier. That would confirm skidoo23's assumption... Cheers

KungFuJesus commented 2 years ago

Was brought here from a closed bug I filed over the same issue. While I can easily file this downstream with the maintainers and they can block this version of libid3tag - it seems like distros are under the impression that tenacity's fork is the current upstream.

I'll concede this very well may be an upstream bug, but that pointer dereference exists in 0.15 as well. At very least if they are to become the new upstream, it'd be good to get to the bottom of why this happens. Clearly there's an unexpected NULL tag pointer being passed up the stack.

triffid commented 2 years ago

I wrote the issue that @taschenlampe mentioned, ie https://github.com/tenacityteam/libid3tag/issues/6 and a tentative fix, https://github.com/tenacityteam/libid3tag/issues/7.

Git blame says the bug I issued a fix for came with 0.15.1b from the official upstream at sourceforge - but there's not much point sending fixes to a project that appears to have been abandoned for almost 2 decades, so I sent it to the tenacityteam fork which seems to have at least some attempt at maintenance and is listed as the upstream source for at least the Gentoo libid3tag package.

Downgrading libid3tag to official 0.15.1b from sourceforge should therefore not affect this issue at all, and may reintroduce others that were subsequently fixed by tenacityteam.