A beta tester has reported a bug in a plug-in I’m working on that sounds like a possible deadlock. When run in Pro Tools on an old PPC Mac with a high CPU load instances of my plug-in freeze and the audio on that track stops entirely. This is a visualization plug-in which doesn’t alter the incoming AudioBuffer at all, it just reads from I know the lack of audio isn’t just me muting everything by mistake. I’m not using the callback lock at all for anything and I’m never suspending processing on my AudioProcessor either.
There are a couple of unusual things I am doing but I’m having trouble seeing how they could result in a deadlock.
I have a lock that I use when settings are changed or the plug-in state is loaded. In my processBlock I’m using a tryEnter() to test this lock. If it’s locked I just return out of processBlock early and the visualisation stuff doesn’t get updated that frame. This ought to be fine as I’m not changing the AudioBuffer in my processBlock anyway. Right?
My AudioProcessor is a ChangeBroadcaster and occasionally I send a change message. I’m aware that this could “cause problems” and I probably shouldn’t be doing things this way, but what are those problems? Could they amount to the behaviour I’m seeing?
I’m posting some messages to a MessageListener. Should I avoid this the same as I ought to avoid the change message stuff? Is this a big enough issue to account for the problem I’m seeing here?
It looks like all of this messaging stuff I have could do with a rewrite, but I’d really like to be sure that this is what’s causing my problems before I do so, and understand why it’s causing them.
Any pointers would be very gratefully received!