Fork fails

Sam Couter sam at topic.com.au
Thu Sep 19 16:55:56 EST 2002


Michael Still <mikal at stillhq.com> wrote:
> I have an app which forks 4500 times or so (don't ask, it's a long story).

The story is probably a horror story. It sounds too hardcore for me to
want to know. :)

> I am finding that about half of the forks return -1, and it looks like
> this might mostly be the last half or so. Is there some sort of prcoess
> limit I am bumping up against that I might not be aware of (this is on
> 2.4.18 x86 if that matters)?

I'm assuming you've checked 'ulimit -a'? The important limit is max user
processes. Set it using ulimit -u, when using bash at least. On my
system (Debian) it defaults to 256.

> Is it safe to assume this is just temporary resource exhaustion, wait a
> couple of seconds, and then try again?

Check errno after the failed fork(2) call. The man page on my system
lists EAGAIN and ENOMEM as possible return codes. EAGAIN is usually
interpreted as a temporary failure.
-- 
Sam "Eddie" Couter  |  mailto:sam at topic.com.au
Internet Engineer   |  jabber:sam at jabber.topic.com.au
tSA Consulting      |  http://www.topic.com.au/
OpenPGP fingerprint:  A46B 9BB5 3148 7BEA 1F05  5BD5 8530 03AE DE89 C75C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux/attachments/20020919/eca66ea1/attachment.bin


More information about the linux mailing list