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

Corruption occurring in voice manager #695

Closed
jpcima opened this issue Mar 11, 2021 · 4 comments · Fixed by #717
Closed

Corruption occurring in voice manager #695

jpcima opened this issue Mar 11, 2021 · 4 comments · Fixed by #717
Labels
bug Something isn't working

Comments

@jpcima
Copy link
Collaborator

jpcima commented Mar 11, 2021

Obtained with following instrument and MIDI Fuzz plugin
WilkinsonAudio.NakedDrums/Wilkinson Audio/Naked Drums/Stereo/Naked Drums OH.sfz

==2419555== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
==2418969== Thread 14:
==2418969== Conditional jump or move depends on uninitialised value(s)
==2418969==    at 0x7B8D68F: sfz::Voice::checkOffGroup(sfz::Region const*, int, int) (Voice.cpp:1474)
==2418969==    by 0x7B525B8: sfz::Synth::Impl::noteOnDispatch(int, int, float) (Synth.cpp:1112)
==2418969==    by 0x7B5273A: sfz::Synth::noteOn(int, int, unsigned char) (Synth.cpp:1027)
==2418969==    by 0x7A6B4C5: SfizzVstProcessor::processEvents(Steinberg::Vst::IEventList&) (SfizzVstProcessor.cpp:460)
==2418969==    by 0x7A6D298: SfizzVstProcessor::process(Steinberg::Vst::ProcessData&) (SfizzVstProcessor.cpp:262)
==2418969==    by 0x2A7FF8: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x21D914: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x221505: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x19289F: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x192C74: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x192D71: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x570D229: ??? (in /usr/lib/libjack.so.0.1.0)
==2418969== 
Assert failed: ampegOut.data()
Assert failed at /home/jpc/documents/projects/sfizz/src/sfizz/Voice.cpp:735
==2418969== 
==2418969== Process terminating with default action of signal 5 (SIGTRAP): dumping core
==2418969==    at 0x7B907F2: sfz::Voice::Impl::amplitudeEnvelope(absl::lts_2020_02_25::Span<float>) (Voice.cpp:735)
==2418969==    by 0x7B90B11: sfz::Voice::Impl::ampStageStereo(sfz::AudioSpan<float, 2ul>) (Voice.cpp:781)
==2418969==    by 0x7B99AEF: sfz::Voice::renderBlock(sfz::AudioSpan<float, 2ul>) (Voice.cpp:637)
==2418969==    by 0x7B57B2D: sfz::Synth::renderBlock(sfz::AudioSpan<float, 2ul>) (Synth.cpp:928)
==2418969==    by 0x7AA694F: sfz::Sfizz::renderBlock(float**, unsigned long, int) (sfizz.cpp:184)
==2418969==    by 0x7A6D30C: SfizzVstProcessor::process(Steinberg::Vst::ProcessData&) (SfizzVstProcessor.cpp:272)
==2418969==    by 0x2A7FF8: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x21D914: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x221505: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x19289F: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x192C74: ??? (in /usr/lib/carla/carla-bridge-native)
==2418969==    by 0x192D71: ??? (in /usr/lib/carla/carla-bridge-native)
@jpcima
Copy link
Collaborator Author

jpcima commented Mar 11, 2021

A more complete trace

==2430730== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
==2429936== Thread 14:
==2429936== Conditional jump or move depends on uninitialised value(s)
==2429936==    at 0x7B8D68F: sfz::Voice::checkOffGroup(sfz::Region const*, int, int) (Voice.cpp:1474)
==2429936==    by 0x7B525B8: sfz::Synth::Impl::noteOnDispatch(int, int, float) (Synth.cpp:1112)
==2429936==    by 0x7B5273A: sfz::Synth::noteOn(int, int, unsigned char) (Synth.cpp:1027)
==2429936==    by 0x7A6B4C5: SfizzVstProcessor::processEvents(Steinberg::Vst::IEventList&) (SfizzVstProcessor.cpp:460)
==2429936==    by 0x7A6D298: SfizzVstProcessor::process(Steinberg::Vst::ProcessData&) (SfizzVstProcessor.cpp:262)
==2429936==    by 0x2A7FF8: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21D914: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x221505: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x19289F: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x192C74: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x192D71: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x570D229: ??? (in /usr/lib/libjack.so.0.1.0)
==2429936==  Uninitialised value was created by a heap allocation
==2429936==    at 0x483EDEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==2429936==    by 0x7B9279C: sfz::Voice::Voice(int, sfz::Resources&) (Voice.cpp:285)
==2429936==    by 0x7BC1157: construct<sfz::Voice, int&, sfz::Resources&> (new_allocator.h:150)
==2429936==    by 0x7BC1157: construct<sfz::Voice, int&, sfz::Resources&> (alloc_traits.h:512)
==2429936==    by 0x7BC1157: emplace_back<int&, sfz::Resources&> (vector.tcc:115)
==2429936==    by 0x7BC1157: sfz::VoiceManager::requireNumVoices(int, sfz::Resources&) (VoiceManager.cpp:170)
==2429936==    by 0x7B53A99: sfz::Synth::Impl::resetVoices(int) (Synth.cpp:1563)
==2429936==    by 0x7B56C3A: sfz::Synth::Impl::Impl() (Synth.cpp:59)
==2429936==    by 0x7B56EE0: sfz::Synth::Synth() (Synth.cpp:41)
==2429936==    by 0x7AA65C2: make_unique<sfz::Synth> (unique_ptr.h:962)
==2429936==    by 0x7AA65C2: sfz::Sfizz::Sfizz() (sfizz.cpp:14)
==2429936==    by 0x7A6C75B: SfizzVstProcessor::initialize(Steinberg::FUnknown*) (SfizzVstProcessor.cpp:86)
==2429936==    by 0x2A22F9: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2A5322: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x293C56: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x293E19: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936== 
==2429936== Thread 1:
==2429936== Invalid read of size 4
==2429936==    at 0x7AC1082: SPiano::setKeyValue(unsigned int, float) (GUIPiano.cpp:122)
==2429936==    by 0x7A73529: uiReceiveValue (EditorController.h:46)
==2429936==    by 0x7A73529: SfizzVstEditor::processNoteEventQueue() (SfizzVstEditor.cpp:296)
==2429936==    by 0x7A743F6: SfizzVstEditor::notify(VSTGUI::CBaseObject*, char const*) (SfizzVstEditor.cpp:160)
==2429936==    by 0x7B23CB2: operator() (std_function.h:622)
==2429936==    by 0x7B23CB2: VSTGUI::CVSTGUITimer::fire() (cvstguitimer.cpp:111)
==2429936==    by 0x2D5B26: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2D6BC1: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2D9622: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x22F602: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x154FC0: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x155224: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x14FBEB: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x5049B24: (below main) (in /usr/lib/libc-2.33.so)
==2429936==  Address 0x14ae1df8 is 8 bytes after a block of size 480 alloc'd
==2429936==    at 0x483EDEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==2429936==    by 0x7AC2FC3: allocate (new_allocator.h:115)
==2429936==    by 0x7AC2FC3: allocate (alloc_traits.h:460)
==2429936==    by 0x7AC2FC3: _M_allocate (stl_vector.h:346)
==2429936==    by 0x7AC2FC3: std::vector<float, std::allocator<float> >::_M_default_append(unsigned long) (vector.tcc:635)
==2429936==    by 0x7AC1F32: resize (stl_vector.h:940)
==2429936==    by 0x7AC1F32: setNumOctaves (GUIPiano.cpp:79)
==2429936==    by 0x7AC1F32: SPiano::SPiano(VSTGUI::CRect) (GUIPiano.cpp:53)
==2429936==    by 0x7AB43D7: operator() (Editor.cpp:815)
==2429936==    by 0x7AB43D7: Editor::Impl::createFrameContents() (main.hpp:171)
==2429936==    by 0x7AB61F8: Editor::Editor(EditorController&) (Editor.cpp:247)
==2429936==    by 0x7A73F90: SfizzVstEditor::open(void*, VSTGUI::PlatformType const&) (SfizzVstEditor.cpp:64)
==2429936==    by 0x7AA5EA8: Steinberg::Vst::VSTGUIEditor::attached(void*, char const*) (vstguieditor.cpp:169)
==2429936==    by 0x28A240: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x391C4E: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x3D9FBB: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21CD58: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21CF83: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936== 
==2429936== Invalid write of size 4
==2429936==    at 0x7AC1025: SPiano::setKeyValue(unsigned int, float) (GUIPiano.cpp:125)
==2429936==    by 0x7A73529: uiReceiveValue (EditorController.h:46)
==2429936==    by 0x7A73529: SfizzVstEditor::processNoteEventQueue() (SfizzVstEditor.cpp:296)
==2429936==    by 0x7A743F6: SfizzVstEditor::notify(VSTGUI::CBaseObject*, char const*) (SfizzVstEditor.cpp:160)
==2429936==    by 0x7B23CB2: operator() (std_function.h:622)
==2429936==    by 0x7B23CB2: VSTGUI::CVSTGUITimer::fire() (cvstguitimer.cpp:111)
==2429936==    by 0x2D5B26: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2D6BC1: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2D9622: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x22F602: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x154FC0: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x155224: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x14FBEB: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x5049B24: (below main) (in /usr/lib/libc-2.33.so)
==2429936==  Address 0x14ae1e00 is 16 bytes after a block of size 480 alloc'd
==2429936==    at 0x483EDEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==2429936==    by 0x7AC2FC3: allocate (new_allocator.h:115)
==2429936==    by 0x7AC2FC3: allocate (alloc_traits.h:460)
==2429936==    by 0x7AC2FC3: _M_allocate (stl_vector.h:346)
==2429936==    by 0x7AC2FC3: std::vector<float, std::allocator<float> >::_M_default_append(unsigned long) (vector.tcc:635)
==2429936==    by 0x7AC1F32: resize (stl_vector.h:940)
==2429936==    by 0x7AC1F32: setNumOctaves (GUIPiano.cpp:79)
==2429936==    by 0x7AC1F32: SPiano::SPiano(VSTGUI::CRect) (GUIPiano.cpp:53)
==2429936==    by 0x7AB43D7: operator() (Editor.cpp:815)
==2429936==    by 0x7AB43D7: Editor::Impl::createFrameContents() (main.hpp:171)
==2429936==    by 0x7AB61F8: Editor::Editor(EditorController&) (Editor.cpp:247)
==2429936==    by 0x7A73F90: SfizzVstEditor::open(void*, VSTGUI::PlatformType const&) (SfizzVstEditor.cpp:64)
==2429936==    by 0x7AA5EA8: Steinberg::Vst::VSTGUIEditor::attached(void*, char const*) (vstguieditor.cpp:169)
==2429936==    by 0x28A240: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x391C4E: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x3D9FBB: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21CD58: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21CF83: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936== 
==2429936== Invalid read of size 4
==2429936==    at 0x7AC1020: SPiano::setKeyValue(unsigned int, float) (GUIPiano.cpp:122)
==2429936==    by 0x7A73529: uiReceiveValue (EditorController.h:46)
==2429936==    by 0x7A73529: SfizzVstEditor::processNoteEventQueue() (SfizzVstEditor.cpp:296)
==2429936==    by 0x7A743F6: SfizzVstEditor::notify(VSTGUI::CBaseObject*, char const*) (SfizzVstEditor.cpp:160)
==2429936==    by 0x7B23CB2: operator() (std_function.h:622)
==2429936==    by 0x7B23CB2: VSTGUI::CVSTGUITimer::fire() (cvstguitimer.cpp:111)
==2429936==    by 0x2D5B26: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2D6BC1: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x2D9622: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x22F602: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x154FC0: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x155224: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x14FBEB: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x5049B24: (below main) (in /usr/lib/libc-2.33.so)
==2429936==  Address 0x14ae1df8 is 8 bytes after a block of size 480 alloc'd
==2429936==    at 0x483EDEF: operator new(unsigned long) (vg_replace_malloc.c:342)
==2429936==    by 0x7AC2FC3: allocate (new_allocator.h:115)
==2429936==    by 0x7AC2FC3: allocate (alloc_traits.h:460)
==2429936==    by 0x7AC2FC3: _M_allocate (stl_vector.h:346)
==2429936==    by 0x7AC2FC3: std::vector<float, std::allocator<float> >::_M_default_append(unsigned long) (vector.tcc:635)
==2429936==    by 0x7AC1F32: resize (stl_vector.h:940)
==2429936==    by 0x7AC1F32: setNumOctaves (GUIPiano.cpp:79)
==2429936==    by 0x7AC1F32: SPiano::SPiano(VSTGUI::CRect) (GUIPiano.cpp:53)
==2429936==    by 0x7AB43D7: operator() (Editor.cpp:815)
==2429936==    by 0x7AB43D7: Editor::Impl::createFrameContents() (main.hpp:171)
==2429936==    by 0x7AB61F8: Editor::Editor(EditorController&) (Editor.cpp:247)
==2429936==    by 0x7A73F90: SfizzVstEditor::open(void*, VSTGUI::PlatformType const&) (SfizzVstEditor.cpp:64)
==2429936==    by 0x7AA5EA8: Steinberg::Vst::VSTGUIEditor::attached(void*, char const*) (vstguieditor.cpp:169)
==2429936==    by 0x28A240: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x391C4E: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x3D9FBB: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21CD58: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21CF83: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936== 
Assert failed: ampegOut.data()
Assert failed at /home/jpc/documents/projects/sfizz/src/sfizz/Voice.cpp:735
==2429936== 
==2429936== Process terminating with default action of signal 5 (SIGTRAP): dumping core
==2429936==    at 0x7B907F2: sfz::Voice::Impl::amplitudeEnvelope(absl::lts_2020_02_25::Span<float>) (Voice.cpp:735)
==2429936==    by 0x7B90943: sfz::Voice::Impl::ampStageMono(sfz::AudioSpan<float, 2ul>) (Voice.cpp:767)
==2429936==    by 0x7B99A27: sfz::Voice::renderBlock(sfz::AudioSpan<float, 2ul>) (Voice.cpp:641)
==2429936==    by 0x7B57B2D: sfz::Synth::renderBlock(sfz::AudioSpan<float, 2ul>) (Synth.cpp:928)
==2429936==    by 0x7AA694F: sfz::Sfizz::renderBlock(float**, unsigned long, int) (sfizz.cpp:184)
==2429936==    by 0x7A6D30C: SfizzVstProcessor::process(Steinberg::Vst::ProcessData&) (SfizzVstProcessor.cpp:272)
==2429936==    by 0x2A7FF8: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x21D914: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x221505: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x19289F: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x192C74: ??? (in /usr/lib/carla/carla-bridge-native)
==2429936==    by 0x192D71: ??? (in /usr/lib/carla/carla-bridge-native)

@paulfd
Copy link
Member

paulfd commented Mar 15, 2021

This is when running it tooled with asan? On a quick check I think checkOffGroup could return false if the voice is idle. The only thing that can be uninitialized here is the triggerEvent variable, which shouldn't be if the region is not nullptr, so it's a bit weird...

@paulfd paulfd added the bug Something isn't working label Mar 17, 2021
@jpcima
Copy link
Collaborator Author

jpcima commented Mar 18, 2021

Not ASAN, it's a valgrind run with track-origins=yes (the second one)

@jpcima
Copy link
Collaborator Author

jpcima commented Mar 18, 2021

In startVoice, the voice does not get its trigger event due to this early return

    if (region->disabled())
        return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants