Debian bug #128632 && fork

Colin Walters walters at debian.org
Tue Feb 19 10:01:05 EST 2002


On Mon, 2002-02-18 at 17:53, Martin Pool wrote:
> On 18 Feb 2002, Wayne Davison <wayned at users.sourceforge.net> wrote:
> > On Mon, 18 Feb 2002, Martin Pool wrote:
> > > Why the sleep() call?
> 
> I guess the point is that the fork() probably failed because the
> server is overloaded, and therefore there is no point trying to accept
> another connection again immediately.  I just wanted to check this was
> the reason.

Exactly.  I got the idea from Postfix.  Upon encountering resource
exhaustion, back off.  This also has the nice property of preventing the
log files from getting filled easily.

> > Also, why close(fd) twice?

Well, it's best to close the fd as soon as we can, to free resources. 
The second close should just fail harmlessly.  We could add a
"continue;" after the sleep if you think it's a problem.





More information about the rsync mailing list