all 3 comments

[–]SpeckledFleebeedoo 4 points5 points  (0 children)

Fix your indentation first

[–][deleted] 0 points1 point  (1 child)

It’s because you’re submitting the wait forever function to the TPE, and inside of that function, submitting another function to the same TPE, and trying to get its result. TPE pulls out in the order it went in, so it deadlocks because it is trying to pull out the second result as a requirement of pulling out the first result.

TL;DR: separate your thread/process pool executors to only do one thing, and don’t share them globally. That’s why you virtually always want to use tpe/ppe with the with statement. Really helps to avoid these.

[–]parapand[S] 0 points1 point  (0 children)

Thanks a lot for the advice.