Subject: Re: cannot fork errors...
To: Zach Fine <zach@xdsl014.serv.net>
From: Kevin P. Neal <kpneal@pobox.com>
List: netbsd-help
Date: 03/03/2000 21:37:28
On Fri, Mar 03, 2000 at 01:26:58PM -0800, Zach Fine wrote:
> A php3 script of mine is producing 'Cannot fork' errors and sometimes
> segfaults in the apache error_log whenever it attempts to execute a
> system() command. Someone on the php mailing list suggested that I
> allow more processes and file descripters per user.
Wait, it does this *sometimes* or it does it *always*?
> I could perhaps do this by running apache from a shell script which
> would first set these limits with 'ulimit -p 4000' or somesuch, but
> isn't there some relation between maxproc, CHILD_MAX, OPEN_MAX, and
> maxusers that needs to be maintained? Will I first need to increase
> maxusers and compile a new kernel? Will I need to make changes to
> CHILD_MAX in /usr/src/sys/sys/syslimits.h?
Uh, hold on.
Which NetBSD platform? Which Apache? What do you have MaxClients set to?
Are you setting RLimitProc (sp?) in the Apache config file?
Now, yes, there is a relation between maxproc, etc etc, and maxusers.
The value for maxusers is set in your kernel config file. The maximum
value systemwide of maxproc (that is, the size of the process table)
is (if I'm not mistaken) maxusers * 16 + 20. If you fill it then the
kernel will bark at you: "/netbsd: proc table full" and nobody will be
able to fork().
How many processes are you using currently? How many open files do you
have systemwide (find out from the first line of pstat -T)? Here's the
output of pstat -T on my box:
229/3404 files
1323 vnodes
220M/485M swap space
So I'm not even using 10% of my open files limit (with maxusers set to 64).
If you run out of processes or files systemwide you need to increase maxusers.
If you only run out for the userid Apache is running as then you need
to do as you say and ulimit -p 4000 (or, as you say, somesuch) if it
won't work from the Apache config file. It's better if you set the limit
in the Apache config file.
Don't dink with CHILD_MAX in ".../syslimits.h".
--
Kevin P. Neal http://www.pobox.com/~kpn/
"You know, I think I can hear the machine screaming from here... \
'help me! hellpp meeee!'" - Heather Flanagan, 14:52:23 Wed Jun 10 1998