Subject: | hang from waitpid conflict |
Date: | Wed, 8 Jul 2015 16:00:59 +0100 |
To: | bug-Parallel-ForkManager [...] rt.cpan.org |
From: | Zefram <zefram [...] fysh.org> |
The waitpid-conflict test fails, with a hang, one time in every
four that it's run. This happens because of a bug in the internal
wait_one_child abstraction. P:FM waits for each child individually in
turn, and will return from wait_one_child when it has successfully reaped
a managed child. If a child turns out to have been reaped externally,
it is dropped from the managed set immediately, and is not returned as a
successfully-reaped managed process. So after that the process of waiting
for a managed child to terminate must continue. If the externally-reaped
child happens to be the last one left, it will drop out of the managed
set, and then there are no managed children left that could be returned
from wait_one_child, so that call can't return. Instead there's an
infinite wait for the waiting on no processes to return a reaped process.
Attached patch fixes, by making wait_one_child return -1 (indicating
error) if there are no managed children left without one having been
successfully reaped.
-zefram
Message body is not shown because sender requested not to inline it.