scriptnode / convolution + oversampling = read access violation. mtx was 0x100.
-
I could use a hand debugging a crash I'm getting in scriptnode. I've traced this down to the oversampling node.
I have:
- convolution node wrapped in 4x oversampling
- dsp exported to dll
- dll loaded in hardcoded fx
The compiled vst plug-in is crashing when switching impulses.
Callstack:
> Convolution Test Debug.vst3!mtx_do_lock(_Mtx_internal_imp_t * mtx, const xtime * target) Line 88 C++ Convolution Test Debug.vst3!_Mtx_lock(_Mtx_internal_imp_t * mtx) Line 174 C++ Convolution Test Debug.vst3!std::_Mutex_base::lock() Line 50 C++ Convolution Test Debug.vst3!std::unique_lock<std::mutex>::unique_lock<std::mutex>(std::mutex & _Mtx) Line 134 C++ Convolution Test Debug.vst3!juce::WaitableEvent::wait(int timeOutMilliseconds) Line 33 C++ Convolution Test Debug.vst3!juce::Thread::wait(int timeOutMilliseconds) Line 302 C++ Convolution Test Debug.vst3!hise::ConvolutionEffectBase::reloadInternal() Line 648 C++ Convolution Test Debug.vst3!hise::ConvolutionEffectBase::handleAsyncUpdate() Line 273 C++ Convolution Test Debug.vst3!hise::ConvolutionEffectBase::setImpulse(juce::NotificationType sync) Line 222 C++ Convolution Test Debug.vst3!scriptnode::filters::convolution::setExternalData(const snex::ExternalData & d, int index) Line 53 C++ Convolution Test Debug.vst3!scriptnode::data::pimpl::plain<0,2>::setExternalData<scriptnode::filters::convolution>(scriptnode::filters::convolution & n, const snex::ExternalData & b, int index) Line 1003 C++ Convolution Test Debug.vst3!scriptnode::wrap::data<scriptnode::filters::convolution,scriptnode::data::pimpl::plain<0,2>>::setExternalData(const snex::ExternalData & data, int index) Line 874 C++ Convolution Test Debug.vst3!convolution_impl::instance::setExternalData(const snex::ExternalData & b, int index) Line 75 C++ Convolution Test Debug.vst3!scriptnode::wrap::node<convolution_impl::instance>::setExternalData(const snex::ExternalData & d, int index) Line 1394 C++ Convolution Test Debug.vst3!scriptnode::prototypes::static_wrappers<scriptnode::wrap::node<convolution_impl::instance>>::setExternalData(void * obj, const snex::ExternalData * d, int index) Line 211 C++ Convolution Test Debug.vst3!scriptnode::OpaqueNode::setExternalData(const snex::ExternalData & b, int index) Line 90 C++ Convolution Test Debug.vst3!hise::HardcodedSwappableEffect::DataWithListener::updateData() Line 112 C++ Convolution Test Debug.vst3!hise::HardcodedSwappableEffect::DataWithListener::onComplexDataEvent(hise::ComplexDataUIUpdaterBase::EventType t, juce::var newValue) Line 122 C++ Convolution Test Debug.vst3!hise::ComplexDataUIUpdaterBase::sendMessageToListeners(hise::ComplexDataUIUpdaterBase::EventType t, juce::var v, juce::NotificationType n, bool forceUpdate) Line 1146 C++ Convolution Test Debug.vst3!hise::ComplexDataUIUpdaterBase::Updater::timerCallback() Line 1106 C++ Convolution Test Debug.vst3!hise::PooledUIUpdater::timerCallback() Line 962 C++ Convolution Test Debug.vst3!hise::SuspendableTimer::Internal::timerCallback() Line 815 C++ Convolution Test Debug.vst3!juce::Timer::TimerThread::callTimers() Line 119 C++ Convolution Test Debug.vst3!juce::Timer::TimerThread::CallTimersMessage::messageCallback() Line 181 C++ Convolution Test Debug.vst3!juce::InternalMessageQueue::dispatchMessage(juce::MessageManager::MessageBase * message) Line 202 C++ Convolution Test Debug.vst3!juce::InternalMessageQueue::dispatchMessages() Line 240 C++ Convolution Test Debug.vst3!juce::InternalMessageQueue::messageWndProc(HWND__ * h, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 163 C++
The same setup works as expected without the oversampling node.
-
and the cure..... wrap dsp in a fix_block
-
@Dan-Korneff good catch.
-
I take it back. Not cured.
@Christoph-Hart does a read access violation associated with mtx sound familiar?
it's 100% related to oversampling, cause I can hammer the convolution node with impulse changes with no crash when oversampling isn't used. -
@Dan-Korneff it might just create internal buffers beyond a certain limit? Can you reliably make it crash with oversampling?
-
Can you reliably make it crash with oversampling?
yeah, here's a minimal example that uses a timer to toggle between impulses. The exact time it takes to crash isn't consistent, but it takes less than a minute.
I believe it may have something to do with multithreading.
https://hub.korneffaudio.com/index.php/s/MBtPXHXXtZYcLZW -
definitely something with multi-threading. I turned it off on the example project and I just ran the compiled plugin for over 10 minutes now. No crashes.
-
@Christoph-Hart anything else I can do to get this on your radar? I think it's the source of some Logic crash reports I'm getting with projects containing scriptnode/convoltion/oversampling.
-
@Dan-Korneff do I have to compile the minimal project to a plugin or does it crash in HISE too?
-
@Christoph-Hart You'll have to compile. It doesn't crash HISE.
-
@Dan-Korneff Alright. And do I have to run it in Logic or is it crashing in other hosts too?
And I assume you're using the latest HISE, right? I fixed a few multithreading issues with convolution in December.
-
@Christoph-Hart I'm using the commit from Feb 6.
I have only tested on PC with Reaper and Cubase, but the Logic crash reports I get are Memory Access error so I'm assuming it's related.