VST3 Crashing Due to IEditController Thread Issues


#1

We’ve had some reports of crashes with the AGain VST3 example plugin and after another developer looked deeply in to the problem and posted this thread on the Steinberg forums (https://sdk.steinberg.net/viewtopic.php?f=4&t=628) it appears it could be a threading issue stemming from the JUCE implementation.

It looks like any editController calls can only be made from the message thread. This seems to be violated in several places in juce_VST3PluginFormat.cpp, mainly when calling setParamNormalized.

Now that Stenberg has deprecated VST2, this is probably higher priority as we can no longer advise our customers to use the VST2 version of plugins.

As much as it pains me to say it, maybe adding a const ScopedLock sl (lock); around the audio thread calls to setParamNormalized might fix it?


#2

Looking at the VST3 SDK a little more, it seems like a lock might not do it. The plugin UI could be accessing the values from the message thread so it’s not safe to ever set them from another thread. From the docs:

	/** Sets the normalized value to the parameter associated to the paramID. The controller must never
	    pass this value-change back to the host via the IComponentHandler. It should update the according
		GUI element(s) only!*/
	virtual tresult PLUGIN_API setParamNormalized (ParamID id, ParamValue value) = 0;

#3

Thanks Dave, we’ll look into this.