As a first step to understand what is going on, I would suggest just clicking Pause in the debugger while you are freezing. It will show you which thread is doing what at that moment.
You will see either a task that is still running, or a msg_trap line indicating that there is a lock somewhere.
Send here what you learned.
source share