I’ve been noticing this behavior for a bit between TE projects, but I finally tried to understand it a bit more. I have a demo project that can faithfully reproduce the hung lock that I’m seeing.
Stuck accessing PlayHead::syncPositions
Sometimes when destroying a previously loaded Edit, a hang around access to PlayHead::syncPositions
via PlayHead::getSyncPositions()
occurs. And the first and only thing I’ve discovered so far that seems to remove the chance for the process to sometimes hang during Edit destruciton, is to not call getTransport().play()
at all on the Edit before destroying it (which of course is not practical, but lends a clue to the issue perhaps).
If the transport has invoked play()
at all, regardless of whether or not the transport is currently playing, there seems to be a chance the hang will occur when the Edit is destroyed. Once it has occurred, there is no recovering, and the app now requires a force quit.
The callstack has shown both what looks like a general position sync of the playhead happening during the hang via audio device callback, and something happening with the retrospective buffers can hang as well - either way, it’s always a call to PlayHead::getSyncPositions() that infinitely locks. On my system it looked like a spin lock that never recovered.
I’m on Windows 10. This is a somewhat recent version of the develop branch of TE (although I’ve had it on all develop commits I’ve tried so far).
Is there anything extra I need to be doing in terms of properly shutting down/cleaning up an Edit or related Transport chores before deleting an Edit? The only thing I could find on the forum was this post, but it seemed to indicate there really wasn’t much involved in deleting it, and by design all of the necessary magic occurs in the destructor I am guessing?
By the looks of it, there are things still in place (like an audio device callback) continuing to attempt some edit playhead position synchronization that ideally would be disconnected and cleaned up before continuing to destroy the Edit. I don’t have a great grasp yet, but so far it seems to be atomic access behavior related to continued access through callbacks combined with what access occurs during destruction of an Edit.
This means that periodically when releasing a previously opened and played edit, the whole process will hang and require a force quit. And although this doesn’t happen every time, and there are moments of normal use, it happens with enough frequency to make consistent app hangs just part of the reality of use, which is super sad.
Any advice here would be greatly appreciated!
Update: This definitely seems due to the RetrospectiveRecordBuffer
calling syncToEdit()