There are two specific cases I would like to ask about here.
- Worker threads - e.g. the limit created from
Builder::worker_threads
and who get passed work viaRuntime::spawn
. - Blocking threads - the limit created from
Builder::max_blocking_threads
and who get spawned/created fromRuntime::spawn_blocking
.
In both of these cases, if the provided Future/Function panic, what happens to the thread where the work was being executed? I know you can find if the task panicked via awaiting on the JoinHandle
and then checking is_panic
on the error.
My main concern is if I have 4 worker threads, and one of them is executing a future which panics, does that reduce the number of worker threads I have to 3? Or will tokio
internally replace the thread and/or catch the panic so it doesn't cause the thread to stop working. (Same for blocking threads - but I guess since those get created on the fly, it's probably less of a concern).