Unexpected hang... unmanaged plugins

Oct 14, 2010 at 3:30 PM

Hello Marc again!

With some unmanaged plugins I still get unexpected behaviour. Problems usually occur when plugin is created or disposed. One of such plugins is A.O.M. Invisible Limiter LL.dll (or A.O.M. Invisible Limiter.dll).

This one crashes badly with Jacobi.Vst.Samples.Host.exe also. The exception I get is Attempted to read o write protected memory... From exception details I would say GetProgramName method is the faulty one.

In my code I get the Attempted to read or write protected memory also, but at totally unexpected locations that are not part of actual plugin host application (audio device handling for ex...). Something smells like memory leak or something. Again, vith other hosts I own this plugin runs perfect.

regards, kasaudio

Oct 14, 2010 at 4:01 PM

Hello again,

just to be precise... I am able to make A.O.M. Invisible limiter to run. But if I call GetEffectName or GetProgramName thing crashes. I assume GetEffectName is not somehow forbidden for host to call. <-> There are no explicite flags that prohibit that. GetProgramName might be problematic with some plugins (those that have only 1 program), so I don't call it in such cases. But GetEffectName is somehow essential.

regards, kasaudio

Oct 15, 2010 at 3:23 AM
Edited Oct 15, 2010 at 3:57 AM

Hi Kas.

This is a fairly generic exception, do you have two threads accessing the HostCommandStubs? I had the Attempted to read write protected memory exception thrown by ProcessReplacing at random interval. I solved this problem by using a thread lock for each call to HostCommandStub plugin host.

regards, Yury 

Oct 15, 2010 at 6:36 AM

Yury has a valid point: VST.NET does no locking whatsoever! So keep that in mind.

If you look at the GetParameterLabel method in http://vstnet.codeplex.com/SourceControl/changeset/view/50709#343837 
you can see I increased the size of the memory that is allocated to receive the label string in. It turned out that some plugins weren't playing by the rules.

That same issue might be going on with GetProgramName (24 chars) and GetEffectName (32 chars). You could try increasing the size of the UnmanagedString and see if it relieves the problem.

If not, then I need the plugin (send it to my email address) to further research the issue...

Oct 15, 2010 at 12:44 PM

Hello everyone!

@ YuryK:

A.O.M. Invisible Limiter.dll crashes with Jacobi.Vst.Samples.Host.exe which is, to my knowlege, a single thread app. In my software it crashes at the very start (before audio device is initialized) and there is only one thread active at crash moment. I do lock things of course and I don't have any problems with 95% of unmanaged vst hosts i own.

@ Marc:

Your explanation makes a lot of sense as I can see no real reason why GetEffectName would fail. Will try that soon and inform you about that.

regards, kasaudio


Oct 15, 2010 at 1:43 PM

Hello Marc again!

enum VstStringConstants
	kVstMaxProgNameLen   = 128,	///< used for #effGetProgramName, #effSetProgramName, #effGetProgramNameIndexed
	kVstMaxParamStrLen   = 128,	///< used for #effGetParamLabel, #effGetParamDisplay, #effGetParamName
	kVstMaxVendorStrLen  = 128,	///< used for #effGetVendorString, #audioMasterGetVendorString
	kVstMaxProductStrLen = 128,	///< used for #effGetProductString, #audioMasterGetProductString
	kVstMaxEffectNameLen = 128	///< used for #effGetEffectName

This has solved the problem!

All unmanaged plugins I own seem to run flawlessly now with my host! Great work.

cheers, kasaudio

Oct 15, 2010 at 8:07 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.