-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[MU3] fix #89216: multiple possible causes of crashes or audible artefacts #7728
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
Conversation
Just FYI: that What has commit 5aea0ab got to do with it? I don't see anything in your PR that reverts anything from that, except for the last chunk, the changes to audio/midi/fluid/voice.cpp |
commit 5aea0ab was “try fixed crash on sample optimize”, which basically is the two As I wrote, if these macros are now unused they can be g/c’d, but the commit was about, and this reverts, these two |
I’m in discussion with @mrbumpy409 (regarding how the MuseScore_General soundfont relates to these) and have feedback from FluidSynth upstream and am especially looking at FluidSynth’s current set of start/end/loopstart/loopend checks: Considering both, I’ll probably change this:
This is more conservative than doing what FluidSynth does, but FluidSynth has tons of other changes which may or may not impact this, so I’d prefer that. Comments? |
I'd say: go for it. |
Not sure whether it is related, but MuseScore 4 gives a few errors on the MuseScore General.sf3 soundfont:
|
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
I've played with this PR and found out that it crashes when on a percussoin staff switching to Note Input mode !?! |
Joachim Schmitz dixit:
I've played wiht this PR and found out that it crashes when on a drum
staff switching to Note Input mode !?!
Oh, ouch. That we can’t have, of course. I’ll try to reproduce this,
will look at it (when doing the other discussed changes).
Thanks,
//mirabilos
--
<ch> you introduced a merge commit │<mika> % g rebase -i HEAD^^
<mika> sorry, no idea and rebasing just fscked │<mika> Segmentation
<ch> should have cloned into a clean repo │ fault (core dumped)
<ch> if I rebase that now, it's really ugh │<mika:#grml> wuahhhhhh
|
Unless I screwed up, that is. Reproducing should be easy: new score, add Congas, select first rest. press N, KABOOM (after a while, several seconds). Stack trace: Does look like some kind of stack corruption to me. The CI artifact (for Windows) does not crash ... Might a MinGW issue, or a Qt 5.15.2 one? Or Debug vs. RelWithDebInfo? |
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Joachim Schmitz dixit:
Unless I screwed up that is. Reproducing should be easy: new score, add
Congas, select first rest. press N, KABOOM
I built that very same commit, and I cannot reproduce this.
From the backtrace you’ve given…
1 std::_Rb_tree<int, std::pair<int const, Ms::StaffType>, std::_Select1st<std::pair<int const, Ms::StaffType>>, std::less<int>, std::allocator<std::pair<int const, Ms::StaffType>>>::empty stl_tree.h 1009 0x10ad72c
2 std::map<int, Ms::StaffType>::empty stl_map.h 464 0x1095988
3 Ms::StaffTypeList::staffType stafftypelist.cpp 29 0xbbad4e
29 if (staffTypeChanges.empty())
30 return firstStaffType;
4 Ms::Staff::staffType staff.cpp 1012 0xaa8afa
[…]
… I’m assuming this to be unrelated. Look at libmscore/stafftypelist.h:
28 class StaffTypeList {
30 std::map<int, StaffType> staffTypeChanges;
33 StaffTypeList() {}
That std::map is never instantiated as far as I can tell.
Perhaps it only works by accident but if the stack/heap
contains something else in that place, it explodes.
bye,
//mirabilos
--
<ch> you introduced a merge commit │<mika> % g rebase -i HEAD^^
<mika> sorry, no idea and rebasing just fscked │<mika> Segmentation
<ch> should have cloned into a clean repo │ fault (core dumped)
<ch> if I rebase that now, it's really ugh │<mika:#grml> wuahhhhhh
|
Yes, maybe your change is just the straw that breaks the camel's back, under some circumstances and on some platforms, compilers, Qt versions... |
Joachim Schmitz dixit:
Yes, maybe your change is just the straw that breaks the camel's back,
under some cicumstancesne and some platforms. But it happens only with
that change of your's, not with any other.
My patch changes the structure layout of a structure which may just be
enough to hit this.
But I assume a new on the map in the constructor should fix it?
|
Where/how to place such a There is a(n empty) constructor,
Happens on MSVC (and with RelWithDebInfo) too, so does not depend on compiler (nor build options). |
Joachim Schmitz dixit:
`std::map` is used in multiple places, but I can't see a `new` on any of them
Oh okay, so this is an embedded object, not a pointer?
Hrm. Then I’m fresh out of ideas.
|
Joachim Schmitz dixit:
Happens on MSVC (and with RelWithDebInfo) too.
So might still be a Qt 5.15.2 issue (which I'm using currently), or a plain Windows one?
Huh.
I have no way to test the latter. I’m both compiling against and
running with 5.15.2+dfsg-5 so either they fixed something in Qt
in the Debian patches or the latter or… dunno.
I’ve also no idea how to debug that under Windows. I’d try to
inspect the various objects involved and their members, even
internal ones, and maybe set a breakpoint to just before the
crash (or, if the debugger has a “time machine”, rewind a bit).
|
@mirabilos : if it is a hard-to-find bug, under Linux you could try to compile (in debug mode) with Address Sanitizer turned on (and then run from command line without the need for a debugger). It then halts whenever a memory/address violation is found. MuseScore/.github/workflows/ci_linux.yml Lines 121 to 122 in 6fe71f9
Maybe it can be enabled also with CMake, but it has been a while since I last compiled MuseScore (and my laptop broke so I cannot check at the moment). If it is a Windows-only bug then it is harder to deal with. I don't know if it is possible to (compile and) run under Wine. Ciao, |
I tested this commit, built myself and on top of the latest 3.x. Sorry, I should have made that clear earlier... |
Joachim Schmitz dixit:
I tested this commit, built myself and on top of the latest 3.x.
No, then you did not test this commit, you tested the commitdiff
between this commit and its parent applied on top of a different
commit. A commit is always the state of the source tree (in git),
not a change (like in other version control systems).
So… on top of which precise commit in the 3.x branch (which *is*
a moving target) did you test this?
|
The latest, 7d1c732, as mentioned above. Last time yesterday. It is if at all, it a slow moving target currently. |
Very strange, I can not reproduce the issue any longer, not even when rebasing to the latest 3.x. |
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
5f4b41e
to
0c0981e
Compare
- Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Adapt sanity checks and corrections to current FluidSynth, which matches real-existing soundfonts better - Add sanity check provided by the SoundFont spec as extra diagnostic - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
0c0981e
to
ca04565
Compare
I’ve updated this as follows:
This works well for me, in both 2.3.2 and 3.2.3 with which I’ve locally tested this. Tests and further review (mostly by diff from the previous installment? though only the I plan on trying to get this into the really-soon-to-be-released Debian 11, so timely OK or veto appreciated. |
@Jojo-Schmitz did you have a chance to look at this again? |
It works fine for me, but I don't recall ever having had the problem this PR is trying to fix |
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
Duplicate of musescore#7728 - Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
- Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others Duplicate of musescore#7728
- Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others Duplicate of musescore#7728
- Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others Duplicate of musescore#7728
3.x is closed for any changes |
- Track sample name so we can issue proper warning messages, show filename - On read errors, issue an error message and mark sample as invalid - Mark sample as invalid if Ogg Vorbis decompression (SF3) fails - Do all sanity checks on {,loop}{start,end} with SF2 semantics for end; only switch end to point to the last sample afterwards in only one place - Add sanity check provided by the SoundFont spec as extra warning - Do not crash if there is no data[] - Issue diagnostics if disabling a sample - Swap two members to improve structure packing/alignment while there - Use unsigned integers for SoundFont element sizes properly Fixes https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others Duplicate of musescore#7728
Resolves: https://bugs.debian.org/985129 and https://musescore.org/en/node/89216 and probably others
only switch end to point to the last sample afterwards in only one place
I’ve tested this patch so far against MuseScore 2.3.2 and am currently testing it against 3.2.3 as well. I’ve added
+ collect_artifacts
so @Jojo-Schmitz can test 3.x HEAD ☺With this patch enabled, multiple issues in MuseScore_General_HQ are found (and also in the nōn-HQ soundfont). I’ve already sent @mrbumpy409 an eMail regarding these, so you can ignore them.
This change basically reverts commit 5aea0ab as I found the root causes for that. I did not do a full revert because I’m unsure if the
log.h
stuff is used elsewhere; if not, please feel free to g/c that as well.