Hi!
I have a bug that causes my UIs to freeze sometimes (seems rather random, but high load increases the likelyhood) when I close the editor.
I tried to read up on it on the forum, and so far the only thing I could gather is to use no MessageManagerLock in the painting code. Ok, no Messagemanager locks in my code, but still it is hanging. SInce the bug is rather random, it is really hard to debug, but I managed to get the stacktraces of the threads that are like involved.
Main Thread:
1 0x00007fffa845a96a in _pthread_cond_wait ()
2 0x0000000123eb8b6e in juce::WaitableEvent::wait(int) const ()
3 0x0000000123ebab5d in juce::ThreadPool::waitForJobToFinish(juce::ThreadPoolJob const*, int) const ()
4 0x0000000123ebad1b in juce::ThreadPool::removeJob(juce::ThreadPoolJob*, bool, int) ()
5 0x0000000124017749 in juce::OpenGLContext::CachedImage::stop() ()
6 0x0000000123f5cf2c in juce::Component::ComponentHelpers::releaseAllCachedImageResources(juce::Component&) ()
7 0x0000000123f5c334 in juce::Component::removeChildComponent(int, bool, bool) ()
8 0x0000000123f60924 in juce::Component::deleteAllChildren() ()
9 0x0000000123cb2549 in JuceVSTWrapper::EditorCompWrapper::~EditorCompWrapper() ()
10 0x0000000123cb16a4 in JuceVSTWrapper::deleteEditor(bool) ()
11 0x0000000123cb0803 in JuceVSTWrapper::dispatcher(int, JuceVSTWrapper::VstOpCodeArguments) ()
12 0x0000000123cafd77 in JuceVSTWrapper::dispatcherCB(VstEffectInterface*, int, int, long long, void*, float) ()
13 0x0000000100357d37 in VST_HostedPlugin::QuitConfig() ()
14 0x00000001003617fb in FxDsp::delConfig() ()
Pool thread 1:
1 0x00007fffa845a5e9 in sched_yield ()
2 0x000000016d95f575 in juce::MessageManagerLock::attemptLock(juce::MessageManagerLock::BailOutChecker*) ()
3 0x000000016d95f821 in juce::MessageManagerLock::MessageManagerLock(juce::MessageManagerLock::BailOutChecker&) ()
4 0x000000016da84288 in juce::OpenGLContext::CachedImage::renderFrame() ()
5 0x000000016da83438 in juce::OpenGLContext::CachedImage::runJob() ()
6 0x000000016da8358d in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
7 0x000000016d930cb8 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) ()
8 0x000000016d95359f in juce::ThreadPool::ThreadPoolThread::run() ()
9 0x000000016d92f0ab in juce::threadEntryPoint() ()
10 0x000000016d9457ea in threadEntryProc ()
Pool thread 2:
1 0x00007fffa845a96a in _pthread_cond_wait ()
2 0x000000016d92e6ee in juce::WaitableEvent::wait(int) const ()
3 0x000000016d95f6e0 in juce::MessageManagerLock::attemptLock(juce::MessageManagerLock::BailOutChecker*) ()
4 0x000000016d95f821 in juce::MessageManagerLock::MessageManagerLock(juce::MessageManagerLock::BailOutChecker&) ()
5 0x000000016da84288 in juce::OpenGLContext::CachedImage::renderFrame() ()
6 0x000000016da83438 in juce::OpenGLContext::CachedImage::runJob() ()
7 0x000000016da8358d in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
8 0x000000016d930cb8 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) ()
9 0x000000016d95359f in juce::ThreadPool::ThreadPoolThread::run() ()
10 0x000000016d92f0ab in juce::threadEntryPoint() ()
11 0x000000016d9457ea in threadEntryProc ()
Pool thread 3:
1 0x00007fffa845a96a in _pthread_cond_wait ()
2 0x0000000123eb8b8b in juce::WaitableEvent::wait(int) const ()
3 0x0000000124016c6d in juce::OpenGLContext::CachedImage::runJob() ()
4 0x0000000124016d8d in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
5 0x0000000123ebb148 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) ()
6 0x0000000123edda7f in juce::ThreadPool::ThreadPoolThread::run() ()
7 0x0000000123eb952b in juce::threadEntryPoint() ()
8 0x0000000123ecfcca in threadEntryProc ()
The OpenGL context code is attach and detached in the top componentās constructor and destructor:
if(frame->product->openGL.isOn()) { gl.attachTo(*this); }
ā¦
gl.detach();
The situation is a busy project, with multiple instances of different plugins using the openGL contexts on the top UI class. I close a UI, freeze! This is what I get when I attach the debugger. I tried deleting all child components to eliminate al timers that could fire a ārepaintā call, but I suppose these calls would have been thread safe anyways.
Iāll keep investigating this, but so far I did not get very far, and this is a looong standing bug, so any help is appreciated ![]()
Iām still on branch develop bc78b2f, but could not find anything related in the change log.
Cheers!
JM

