Tracktion / pluginval

Cross platform plugin testing and validation tool
GNU General Public License v3.0
385 stars 54 forks source link

False negative result in ParameterThreadSafetyTest() - the locks wait() and signal() don't meet #127

Open TheMates opened 3 months ago

TheMates commented 3 months ago

Hi, I am testing my plugin and getting false negative result on the ParameterThreadSafetyTest()

-----------------------------------------------------------------
Starting tests in: pluginval / Parameter thread safety...
*** FAILED: Timeout after 30 secs

Finished validating: C:\Program Files\Common Files\VST3\Audified\U73b Compressor.vst3\Contents\x86_64-win\U73b Compressor.vst3
*** FAILED WITH EXIT CODE: 1

Finished batch validation

I think that it might happen to some more cpu intensive plugins that take more time in processing.

I think this block might finish https://github.com/Tracktion/pluginval/blob/b107dd22701fc3e08ebdea8ea91a83bd25372351/Source/tests/BasicTests.cpp#L624-L634

before the main thread gets to endWaiter.signal(); at the end of this block and we never get the endWaiter.signal() while the main thread is waiting. https://github.com/Tracktion/pluginval/blob/b107dd22701fc3e08ebdea8ea91a83bd25372351/Source/tests/BasicTests.cpp#L651-L667

I am not an expret in threading and in using JUCE thread classes, but when I decreased the number of cycles in the main loop https://github.com/Tracktion/pluginval/blob/b107dd22701fc3e08ebdea8ea91a83bd25372351/Source/tests/BasicTests.cpp#L653

to something like 10-20, the test finished successfully. I am not sure now how to fix it, but someone might be able to figure this out.

drowaudio commented 3 months ago

Hmm, I'm not sure that's actually possible. The main thread (the callAsync block) will signal those two events and the background thread which the test is running on will wait for them in turn.

If the background (test) thread gets to the waiters first, it will wait. If they've already been signalled by the main thread, it will just run over them.


If you pause the debugger whilst the test is running, can you see what each thread is doing?