Kernel panic caused by fork
Julian Elischer
julian at elischer.org
Tue Sep 8 16:24:38 UTC 2009
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
>>
>> #include <sys/types.h>
>> #include <unistd.h>
>>
>> int main() {
>> while(1)
>> fork();
>> return 0;
>> }
>>
>> After running this program I got kernel panic with message
>> "get_pv_entry: increase vm.pmap.shpgperproc"
>> IMHO it is not very good idea to bring entire system down if one process
>> misbehaves in this way, it is maybe much better to kill offending process
>> and to send this message to system log. I am not sure whether the panic is
>> actually caused by process forking forever or when the system tries to
>> create new process when maxproc limit is already reached (since system is
>> only printing warning message that maxproc limit is reached and it only
>> panics when I try to start new process (like ps)).
>> System is FreeBSD 7.2-STABLE
>
> 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.
>
> And it's really a system administration problem rather than a kernel problem,
>
More information about the freebsd-hackers
mailing list