You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first script hangs up on dpg.get_frame_count(). Here's why.
set_frame_callback schedules the callback to run on the handlers thread, as it should.
Eventually the callback gets started. It locks the mutex and goes into time.sleep, at which point Python releases the GIL and lets another thread take over. The mutex remains locked.
The main thread takes over and continues to run the rendering loop. When it goes into get_frame_count, that function attempts to lock the mutex. Note: among the API functions called in the rendering loop, only render_dearpygui_frame and get_frame_count actually lock the mutex; the other two calls don't do it.
Since the mutex is being held by the handlers thread, the main threads enters waiting state, still holding the GIL.
As time passes and sleep is over, the handlers thread wakes up and needs to lock the GIL, which is held by the main thread.
We've got a nice classic deadlock: the handlers thread is waiting for the GIL, and the main thread is waiting on the mutex.
I think I've fixed this kind of deadlocks in my copy of DPG and will eventually push the fix to the main repo, but this won't happen soon. Until that point, avoid making extra API calls from the rendering loop. The default rendering loop (consisting of is_dearpygui_running and render_dearpygui_frame) does not deadlock.
Version of Dear PyGui
Version: 1.11.1
Operating System: Arch Linux
My Issue/Question
When doing heavy processing inside a dpg.mutex in a callback called from set_frame_callback, the application hangs.
To Reproduce
Run:
This doesn't occur without the dpg.mutex or from a mouse or keyboard callback. The following code doesn't hang:
The text was updated successfully, but these errors were encountered: