subprocess_middleware:More robust _suspend_recursive
We've seen in production environment that NoSuchProcess seems to be thrown
from proc.children(recursive=True)
. It's unclear if proc
is actually
gone, despite being suspended earlier in this function, or if the error
comes from some child disappearing in a race during listing of children.
We can determine this however, using proc.is_running()
. If it returns
true, our target process is already reaped, and there is nothing more to
do.
Otherwise, we assume the error to come from a child disappearing during listing, and try again.