Subject: Re: Fork bomb protection patch
To: David Laight <david@l8s.co.uk>
From: None <kpneal@pobox.com>
List: tech-kern
Date: 12/04/2002 21:05:48
On Wed, Dec 04, 2002 at 10:57:55PM +0000, David Laight wrote:
> On Wed, Dec 04, 2002 at 11:38:17PM +0100, ragge@ludd.luth.se wrote:
> > > 
> > > On my 233MHz Alpha when I log in I automatically get about 30 xterms,
> > > Netscape, Gnumeric, etc. The problem I'm seeing is that sometimes bash
> > > (in an xterm) complains that it can't fork because it got EAGAIN.  I'm
> > > not hitting my per-user process limit I don't think -- This minute I
> > > have 58 processes running, with the limit set to 1044. My memory use
> > > is unlimited, I have 64MB of memory, and I have a half gig or so of
> > > swap. 
> > > 
> > > What's up? Is this fork() running into some transient limitation? If
> > > so, can fork() wait a amount of time and then try again? 
> > >
> > Your window manager or whatever starts your window may have a 64-proc
> > limitation; if it starts from xdm it won't have run any dot-scripts.
> > You can check it by doing "sysctl proc.17339.rlimit.maxproc.soft"
> > substituting 17339 for the pid of your window manager.
> 
> You could also be hitting the limit on the number of open files,
> sockets are used to link each program to the X-server.

Not likely. How many files can possibly be opened by 30 xterms starting
shells? Or Netscape 4? Gnumeric? XClock or wmWeather?

Maxusers is compiled in at 64. 

436/3404 files
   1212 vnodes
204M/485M swap space

proc.8385.rlimit.cputime.soft = unlimited
proc.8385.rlimit.cputime.hard = unlimited
proc.8385.rlimit.filesize.soft = unlimited
proc.8385.rlimit.filesize.hard = unlimited
proc.8385.rlimit.datasize.soft = 1073741824
proc.8385.rlimit.datasize.hard = 1073741824
proc.8385.rlimit.stacksize.soft = 33554432
proc.8385.rlimit.stacksize.hard = 33554432
proc.8385.rlimit.coredumpsize.soft = unlimited
proc.8385.rlimit.coredumpsize.hard = unlimited
proc.8385.rlimit.memoryuse.soft = unlimited
proc.8385.rlimit.memoryuse.hard = unlimited
proc.8385.rlimit.memorylocked.soft = unlimited
proc.8385.rlimit.memorylocked.hard = unlimited
proc.8385.rlimit.maxproc.soft = 1044
proc.8385.rlimit.maxproc.hard = 1044
proc.8385.rlimit.descriptors.soft = 3404
proc.8385.rlimit.descriptors.hard = 3404

-- 
"A method for inducing cats to exercise consists of directing a beam of
invisible light produced by a hand-held laser apparatus onto the floor ...
in the vicinity of the cat, then moving the laser ... in an irregular way
fascinating to cats,..." -- US patent 5443036, "Method of exercising a cat"