Kernel panic caused by fork
Ivan Radovanovic
rivanr at gmail.com
Tue Sep 8 16:42:05 UTC 2009
Julian Elischer napisa:
> Cheng Renquan wrote:
>> On Mon, Sep 7, 2009 at 6:59 PM, Ivan Radovanovic<rivanr at gmail.com>
>> wrote:
>>> I was testing FreeBSD's behavior when running many threads at the
>>> same time
>>> (and I find it performs excellent) when I wanted to test how system
>>> will
>>> behave towards program that spawns itself too many times. I wrote a
>>> very
>>> simple program
>> It's just the "fork bomb" problem, all operating system kernels cannot
>> deal with it well,
>>
>> http://en.wikipedia.org/wiki/Fork_bomb
> It's more a tuning problem I think. The system should tune itself so
> that MAXPROX is hit before critical resources are exhausted I think.
> Having said that, there are a lot of resources that need to be watched.
After reading this nice article on wikipedia and learning about that
bash one liner I wanted to check if it really works, but I didn't want
to bring the system down again (and to create crash dump and so on), so
I wanted to limit number of processes for single user and I did
sysctl kern.maxprocperuid=1000
as root, and after that I started bash and typed
:(){ :|:& };:
as normal user
First thing to notice - there was more than 4000 spawned bash processes
(why if I set limit to 1000 per user id?), however system didn't crash
and I was eventually able to recover with
/bin/kill -9 -- -1234
1234 being process group id of bash process
Regards,
Ivan
More information about the freebsd-hackers
mailing list