musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.33k stars 2.66k forks source link

MuseScore 4.2 (self-compiled): assertion failure on Linux during startup #20555

Closed ycollet closed 2 months ago

ycollet commented 11 months ago

Issue type

Crash or freeze

Bug description

During startup, MuseScore crash. There is an error message in the log but I think the problem is elsewhere. The error message in the console:

07:25:44.445 | ERROR | main_thread     | MuseSamplerLibHandler::MuseSamplerLibHandler | Unable to open MuseSampler library, path: /home/collette/.local/share/MuseSampler/lib/libMuseSamplerCoreLib.so
07:25:44.445 | ERROR | main_thread     | MuseSamplerResolver::checkLibrary | Incompatible MuseSampler library; ignoring
07:25:44.445 | ERROR | main_thread     | MuseSamplerLibHandler::MuseSamplerLibHandler | Unable to open MuseSampler library, path: libMuseSamplerCoreLib.so
07:25:44.445 | ERROR | main_thread     | MuseSamplerResolver::checkLibrary | Incompatible MuseSampler library; ignoring

The message just before the crash:

07:25:44.766 | DEBUG | main_thread     | AlsaMidiInPort::connect | Connected to -1
07:25:44.766 | DEBUG | main_thread     | AlsaMidiOutPort::connect | Connected to -1
07:25:44.789 | DEBUG | main_thread     | Score::tick2segment | no measure for tick -1
mscore: /builddir/build/BUILD/MuseScore-4.2.0/src/engraving/types/propertyvalue.h :388 : T mu::engraving::PropertyValue::value() const [with T = mu::String]:  l'assertion « at » a échoué.
Abandon (core dumped)

Steps to reproduce

Just start MuseScore on Fedora 38.

Screenshots/Screen recordings

No response

MuseScore Version

4.2.0

Regression

No.

Operating system

Fedora 38

Additional context

No response

ycollet commented 11 months ago

The flags used for compilation are these ones:

-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 
tstibor commented 11 months ago

I compiled version 4.2.0 on Debian GNU/Linux 11 (bullseye) with: ./ninja_build.sh -j 8 -t release and ran it with: ./build.release/src/app/mscore It works without any problems.

ycollet commented 11 months ago

I just tested without the flags added by the packaging process and it's certainly due to an added flag.

ycollet commented 11 months ago

A stacktrace:

Thread 1 "mscore" received signal SIGSEGV, Segmentation fault.
__memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:833
Downloading source file /usr/src/debug/glibc-2.38-14.fc39.x86_64/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
833             LOAD_ONE_SET((%rsi), PAGE_SIZE * 3, %VMM(12), %VMM(13), %VMM(14), %VMM(15))                                                                                                                   
Missing separate debuginfos, use: dnf debuginfo-install xorg-x11-drv-nvidia-libs-545.29.06-1.fc39.x86_64
(gdb) where
#0  __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:833
#1  0x00007ffff561152b in memcpy (__len=1364345695, __src=<optimized out>, __dest=0x7fff42adb028) at /usr/include/bits/string_fortified.h:29
#2  QResourceFileEngine::read (this=<optimized out>, data=0x7fff42adb028 "DATA", len=1364345695) at io/qresource.cpp:1551
#3  0x00007ffff55f9f94 in QFileDevice::readData (this=<optimized out>, data=0x7fff42adb028 "DATA", len=1364345695) at io/qfiledevice.cpp:461
#4  0x00007ffff5601645 in QIODevicePrivate::read (this=0x3c39790, data=0x7fff42adb028 "DATA", maxSize=maxSize@entry=1364345695, peeking=peeking@entry=false) at io/qiodevice.cpp:1108
#5  0x00007ffff5601973 in QIODevice::read (this=this@entry=0x7fffffffc270, data=<optimized out>, maxSize=maxSize@entry=1364345695) at io/qiodevice.cpp:1053
#6  0x00007ffff56020c5 in QIODevice::readAll (this=this@entry=0x7fffffffc270) at io/qiodevice.cpp:1290
#7  0x00007ffff5c333f3 in QFontDatabase::addApplicationFont (fileName=...) at text/qfontdatabase.cpp:2531
#8  0x0000000000cd47b5 in mu::draw::QFontProvider::addSymbolFont (this=this@entry=0x3af6c30, family=..., path=...)
    at /home/collette/rpmbuild/BUILD/MuseScore-4.2.0/src/framework/draw/internal/qfontprovider.cpp:60
#9  0x00000000010b0597 in mu::engraving::EngravingFont::ensureLoad (this=0x3cd7110) at /home/collette/rpmbuild/BUILD/MuseScore-4.2.0/src/engraving/internal/engravingfont.cpp:96
#10 0x0000000000d5c734 in mu::engraving::EngravingFontsProvider::loadAllFonts (this=<optimized out>) at /home/collette/rpmbuild/BUILD/MuseScore-4.2.0/src/engraving/internal/engravingfontsprovider.cpp:103
#11 mu::engraving::EngravingModule::onInit (this=0x387db90, mode=<optimized out>) at /home/collette/rpmbuild/BUILD/MuseScore-4.2.0/src/engraving/engravingmodule.cpp:135
#12 0x00000000007e78b5 in mu::app::App::run (argv=<optimized out>, argc=<optimized out>, this=0x7fffffffcf40) at /home/collette/rpmbuild/BUILD/MuseScore-4.2.0/src/app/app.cpp:197
#13 main (argc=<optimized out>, argv=<optimized out>) at /home/collette/rpmbuild/BUILD/MuseScore-4.2.0/src/app/main.cpp:343
cbjeukendrup commented 11 months ago

That stack trace looks like it relates to a different crash than the assertion failure mentioned in the topmost comment.

The crash from that stack trace is probably a Qt issue, given that it happens deep inside a Qt method.

It might be useful I you could get a stack trace from that assertion failure. Perhaps it relates to palettes, but that is a bit of a blind guess.

What kind of build is this about? Is it a local build that you created on your own computer, or is it from some package manager?

Does any of these crashes also occur in the official AppImage from MuseScore.org?

And are there indications that this problem occurs in 4.2 only, or not necessarily?

ycollet commented 9 months ago

4.2.1 hangs too. But I think I have a better stack trace this time:

20:23:11.230 | ERROR | main_thread     | MuseSamplerLibHandler::MuseSamplerLibHandler | Unable to open MuseSampler library, path: /home/collette/.local/share/MuseSampler/lib/libMuseSamplerCoreLib.so
20:23:11.230 | ERROR | main_thread     | MuseSamplerResolver::checkLibrary | Incompatible MuseSampler library; ignoring
20:23:11.230 | ERROR | main_thread     | MuseSamplerLibHandler::MuseSamplerLibHandler | Unable to open MuseSampler library, path: libMuseSamplerCoreLib.so
20:23:11.230 | ERROR | main_thread     | MuseSamplerResolver::checkLibrary | Incompatible MuseSampler library; ignoring
20:23:11.232 | DEBUG | main_thread     | ShortcutsRegister::expandStandardKeys | removed 5 shortcut, because they are not bound to standard key
20:23:11.232 | DEBUG | main_thread     | ShortcutsRegister::expandStandardKeys | added 3 shortcut, because they are alternative shortcuts for the given standard keys
20:23:11.232 | WARN  | main_thread     | Qt              | QIODevice::read (QFile, "/home/collette/.local/share/MuseScore/MuseScore4/shortcuts.xml"): device not open
20:23:11.233 | WARN  | main_thread     | Qt              | QIODevice::read (QFile, "/home/collette/.local/share/MuseScore/MuseScore4/midi_mappings.xml"): device not open
20:23:11.240 | WARN  | main_thread     | AbstractCloudService::readTokens | Could not find the tokens file: /home/collette/.local/share/MuseScore/MuseScore4/musescorecom_cred.dat
20:23:11.240 | WARN  | main_thread     | AbstractCloudService::readTokens | Could not find the tokens file: /home/collette/.local/share/MuseScore/MuseScore4/audiocom_cred.dat
20:23:11.421 | DEBUG | main_thread     | InstrumentTemplate::read | InstrumentTemplate:: init instrument <contrabass> not found
[New Thread 0x7fffa27fc6c0 (LWP 10064)]
20:23:11.424 | DEBUG | main_thread     | AlsaMidiInPort::connect | Connected to 0:32:0
20:23:11.424 | DEBUG | main_thread     | AlsaMidiOutPort::connect | Connected to -1
20:23:11.436 | DEBUG | main_thread     | Score::tick2segment | no measure for tick -1
mscore: /builddir/build/BUILD/MuseScore-4.2.1/src/engraving/types/propertyvalue.h :388 : T mu::engraving::PropertyValue::value() const [with T = mu::String]:  l'assertion « at » a échoué.

Thread 1 "mscore" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc-2.38-14.fc39.x86_64/nptl/pthread_kill.c
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                                                                                                       
Missing separate debuginfos, use: dnf debuginfo-install xorg-x11-drv-nvidia-libs-545.29.06-2.fc39.x86_64
(gdb) where
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff4eae8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff4e5c8ee in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff4e448ff in __GI_abort () at abort.c:79
#4  0x00007ffff4e4481b in __assert_fail_base
    (fmt=0x7ffff127a3c7 "%s%s%s :%u : %s%s l'assertion « %s » a échoué.\n%n", assertion=assertion@entry=0x555558037d30 "at", file=file@entry=0x555558002e80 "/builddir/build/BUILD/MuseScore-4.2.1/src/engraving/types/propertyvalue.h", line=line@entry=388, function=function@entry=0x555558028340 "T mu::engraving::PropertyValue::value() const [with T = mu::String]") at assert.c:92
#5  0x00007ffff4e54c57 in __assert_fail
    (assertion=0x555558037d30 "at", file=0x555558002e80 "/builddir/build/BUILD/MuseScore-4.2.1/src/engraving/types/propertyvalue.h", line=388, function=0x555558028340 "T mu::engraving::PropertyValue::value() const [with T = mu::String]") at assert.c:101
#6  0x0000555556133691 in mu::engraving::PropertyValue::value<mu::String> (this=<optimized out>) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/engraving/types/propertyvalue.h:288
#7  mu::engraving::PropertyValue::value<mu::String> (this=<optimized out>) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/engraving/types/propertyvalue.h:288
#8  0x00005555562fad1f in mu::engraving::TextLineBase::setProperty (this=0x55555a271660, id=<optimized out>, v=...) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/engraving/dom/textlinebase.cpp:338
#9  0x00005555560f2887 in mu::engraving::EngravingObject::initElementStyle (this=0x55555a271660, ss=<optimized out>)
    at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/engraving/dom/engravingobject.cpp:324
#10 0x00005555562051b3 in mu::engraving::Pedal::Pedal (this=0x55555a271660, parent=<optimized out>) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/engraving/dom/pedal.cpp:105
#11 0x0000555556a7621e in std::_Construct<mu::engraving::Pedal, mu::engraving::compat::DummyElement*> (__p=<optimized out>) at /usr/include/c++/13/bits/stl_construct.h:109
#12 std::allocator_traits<std::allocator<void> >::construct<mu::engraving::Pedal, mu::engraving::compat::DummyElement*> (__p=<optimized out>) at /usr/include/c++/13/bits/alloc_traits.h:661
#13 std::_Sp_counted_ptr_inplace<mu::engraving::Pedal, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<mu::engraving::compat::DummyElement*> (__a=..., this=<optimized out>)
    at /usr/include/c++/13/bits/shared_ptr_base.h:604
#14 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<mu::engraving::Pedal, std::allocator<void>, mu::engraving::compat::DummyElement*> (__a=..., __p=<optimized out>, this=<optimized out>)
    at /usr/include/c++/13/bits/shared_ptr_base.h:971
#15 std::__shared_ptr<mu::engraving::Pedal, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, mu::engraving::compat::DummyElement*> (__tag=..., this=<optimized out>)
    at /usr/include/c++/13/bits/shared_ptr_base.h:1712
#16 std::shared_ptr<mu::engraving::Pedal>::shared_ptr<std::allocator<void>, mu::engraving::compat::DummyElement*> (__tag=..., this=<optimized out>) at /usr/include/c++/13/bits/shared_ptr.h:464
#17 std::make_shared<mu::engraving::Pedal, mu::engraving::compat::DummyElement*> () at /usr/include/c++/13/bits/shared_ptr.h:1010
#18 makeElement<mu::engraving::Pedal> (score=<optimized out>) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/palette/internal/palettecreator.cpp:94
#19 0x0000555556a59db4 in mu::palette::PaletteCreator::newKeyboardPalette () at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/palette/internal/palettecreator.cpp:1939
#20 0x0000555556a6b3e3 in mu::palette::PaletteCreator::newMasterPaletteTree () at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/palette/internal/palettecreator.cpp:132
#21 0x0000555556a6b984 in mu::palette::PaletteProvider::init (this=0x5555590c1b20) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/palette/internal/paletteprovider.cpp:599
#22 0x0000555555f202b5 in mu::app::App::run (this=0x7fffffffd1c0, argc=1, argv=<optimized out>) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/app/app.cpp:197
#23 0x0000555555a76c35 in main (argc=1, argv=0x7fffffffd638) at /usr/src/debug/mscore-mao-4.2.1-2.fc39.x86_64/src/app/main.cpp:343
cbjeukendrup commented 9 months ago

That reminds me of this issue: #20878, which is also somewhat mysterious because it seems only reproducible on Linux in non-"official" builds. Someone was going to try debugging it using Thread Sanitizer, so perhaps that will enlighten us a little bit!

ycollet commented 9 months ago

If I can help in some way ... I tried the flatpak package 4.2.0, it worked (with some problems while opening some scores). Waiting for 4.2.1 on flatpak.

hfiguiere commented 9 months ago

A similar crash has been reported against the flatpak:

https://github.com/flathub/org.musescore.MuseScore/issues/123

It shows an assert (GLIBCXX_ASSERTIONS is on at build time, see -Wp,-D_GLIBCXX_ASSERTIONS) for an access out of bounds of an array<>.

There is a detailled stack trace on that report. It show an index of -7.

hfiguiere commented 9 months ago

The key to this is to build, even in release, with -D_GLIBCXX_ASSERTIONS. An assert triggered that way IS a programming error and this is why the problem pops on Fedora packages and Flatpak. Not having the assertion of leads to Undefined Behaviour or simply hidden.

ycollet commented 6 months ago

Problem still present on 4.3

Jojo-Schmitz commented 6 months ago

Did you run the install step and start musescore from there?

ycollet commented 6 months ago

I built musescore 4.3 from sources and used mscore from the install directory.

cbjeukendrup commented 2 months ago

Closing as superseded by https://github.com/musescore/MuseScore/issues/20878