I develop in VsCode on Linux, and found a way to freeze debugger with a simple call to rayon. The full source is here, but let me copy the relevant parts here.
There is a vec of structs of type WaveFileData. The call to rayon applies fn detect_sample_rate() to paths from each struct. The fn calls file program on each path and parses the output.
It's likely an issue with how you are calling subprocesses. Each call to detect_sample_rate generates a new subprocess using std::process::Command in rayon threads and adding lldb on top of that likely causes a deadlock. If you serialize the subprocess creation then it should work (which is what happens when you run with one thread). Maybe using something like the hound crate to avoid calling subprocesses entirely?
Please explain what you mean by "serialize"? Separate Command::new().arg() from output() and use mutex to make sure only one command::new happens at a time?
I have already found a workaround in this specific case, I am mostly curious how to avoid the problem in the future.
Ahh, thanks. I did not think in this way because that is where I came from: the rest of the work is just minuscule compared to process call, and that was the reason I added rayon to begin with.