Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Sep 2009 12:59:51 +0200
From:      Ivan Radovanovic <rivanr@gmail.com>
To:        freebsd-hackers@FreeBSD.org
Subject:   Kernel panic caused by fork
Message-ID:  <4AA4E7A7.60503@gmail.com>

next in thread | raw e-mail | index | archive | help
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

kernel backtrace:

(kgdb) bt
#0  doadump () at pcpu.h:196
#1  0xc05fc477 in boot (howto=260) at ../../../kern/kern_shutdown.c:418
#2  0xc05fc782 in panic (fmt=Variable "fmt" is not available.
) at ../../../kern/kern_shutdown.c:574
#3  0xc087bccf in get_pv_entry (pmap=0xca0cb43c, try=0)
    at ../../../i386/i386/pmap.c:2067
#4  0xc087c0db in pmap_insert_entry (pmap=Variable "pmap" is not available.
) at ../../../i386/i386/pmap.c:2203
#5  0xc087f08e in pmap_enter (pmap=0xca0cb43c, va=671973376, access=1 
'\001',
    m=Variable "m" is not available.
) at ../../../i386/i386/pmap.c:3114
#6  0xc082a947 in vm_fault (map=0xca0cb3b0, vaddr=671973376,
    fault_type=1 '\001', fault_flags=0) at ../../../vm/vm_fault.c:891
#7  0xc0881acb in trap_pfault (frame=0xefc1bd38, usermode=1, eva=671975739)
    at ../../../i386/i386/trap.c:828
#8  0xc0882420 in trap (frame=0xefc1bd38) at ../../../i386/i386/trap.c:396
#9  0xc086724b in calltrap () at ../../../i386/i386/exception.s:166
#10 0x280d893b in ?? ()
Previous frame inner to this frame (corrupt stack?)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4AA4E7A7.60503>