Any hints on debugging a deadlock

I have a largish scene which links some collections from other blend files. When I render an animation it deadlocks most of the time. Sometimes immediately, sometimes after 10 - 20 frames.

I run a debug version from a debugger, and when I break the process I see most of the threads are waiting for some mutex (except some threads which are polling for inputs?) . It looks like some mutex deadlock.

I tried to whittle down the blend file to something smaller which exhibits the same deadlock and I could post in a bugreport, but so far no luck.

Posting just a backtrace of the locked threads might still be useful?

I could do some more in-depth debugging, but I’m fairly new to Blender and was a bit overwhelmed by the amount of threads.

I’m not sure what I hope to learn from this post :-). Maybe someone else has a good idea…
See -t N option. you may set it to 1 to see if it works then.

Hard to tell without looking at it in a profiler/debugger, most threads are bound to be in some kind of thread pool and will have a common point where they are idling waiting for work, prime suspects for deadlocks would be threads that are busy “elsewhere”

@ankitm: that’s a good idea, that would confirm it to be a threadlock problem.

@LazyDodo: I’ll snoop around in the various backtraces. I saw a thread waiting on a lock to release an image I think. That doesn’t look like idling in a threadpool to me. I saw a lot of intel TBB in the backtraces as well, so I can probably recognize which threads are in a ‘wait for work’ state. That might help narrow it down to the few threads that are doing something different. Thanks for the tip as well.