[PATCH] rsync kills all user processes on fork failure
Bob Byrnes
byrnes at curl.com
Sun May 12 12:27:02 EST 2002
On May 12, 3:43am, mbp at samba.org (Martin Pool) wrote:
-- Subject: Re: [PATCH] rsync kills all user processes on fork failure
>
> + -- Expand all_pids[] dynamically as needed in do_fork(), to
> + avoid any possibility of overflow.
>
> I can't see any situation in which that would happen. I can understand
> being defensive, but this seems like overkill.
>
-- End of excerpt from Martin Pool
I don't think it can happen currently; I was concerned about the scenario
in which rsync evolves to spawn more subprocesses, and eventually (when
there are more than 10), the failure mechanism will be (very) non-obvious.
Certainly this is unlikely (the array is generously sized), but the
complexity cost to completely prevent the problem is tiny: about a
half dozen lines of code, so I think it is worth considering. Clearly
there is no performance cost, compared to fork().
If you think Realloc is overkill, I'd at least add a check to detect
overflow and panic rather than just stomping past the end of the array.
The magical constant "10" is hidden pretty deeply in the low-level code.
But Realloc is not that much harder, and then there is no limit whatsoever.
Thanks for taking the kill(-1, SIGUSR2) fix: that is by far the most
important part.
Bob Byrnes e-mail: byrnes at curl.com
Curl Corporation phone: 617-761-1200
400 Technology Square, 8th Floor fax: 617-761-1201
Cambridge, MA 02139
More information about the rsync
mailing list