From owner-freebsd-hackers Thu Aug 8 11:32:20 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA04161 for hackers-outgoing; Thu, 8 Aug 1996 11:32:20 -0700 (PDT) Received: from cmr.kiev.ua (cmr.kiev.ua [193.193.193.50]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id LAA04130 for ; Thu, 8 Aug 1996 11:31:09 -0700 (PDT) Received: (archer@localhost) by cmr.kiev.ua (Sendmail 8.who.cares/5) id TAA15058; Thu, 8 Aug 1996 19:19:17 GMT Date: Thu, 8 Aug 1996 22:19:17 +0300 (EET DST) From: "Litvin Alexander B. " To: hackers@freebsd.org Subject: "Panick" - help needed... Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hello, All! I was advised by J.K.Habbard to send this into freebsd.hackers, so here my "problem" goes... I tried to figure out how would FreeBSD behave under heavy load. For this purpose I wrote the simple program. It creates 200 copies of itself, and then each copy tries to give system some work, that is opens a file and writes into it randomly and also allocates memory, uses it and frees memory afterwards. Here it is: #include #include #include int main() { int incarnation; /* Program incarnation */ int i,j; /* Counters */ int descriptor; /* File descriptor */ int PID,status; /* Self-explaining */ char buffer[512]; /* Buffer for file operations */ int written; /* Bytes written */ char name[10]; /* For file name */ double t; /* Temporary */ char* p=NULL; /* Dinamic allocated memory pointer */ for(incarnation=0;incarnation<200;incarnation++) { PID=fork(); /* Let's create another incarnation */ if(PID==-1) { printf("Cannot create another process, %d\n",incarnation); break; } if(!PID) break; } sprintf(name,"%d",getpid()); descriptor=open(name,O_CREAT|O_WRONLY,0777); /* Create temporary file */ if(descriptor==-1) { printf("Cannot create another file, %d\n",incarnation); exit(-1); } srand(incarnation); /* Make some randomization */ for(i=0;i<1000;i++) /* Do some work */ { written=write(descriptor,buffer,512); if(written!=512) { printf("Cannot write file, %d\n",incarnation); close(descriptor); if(p) free(p); exit(-1); } /* We'll write into file at random position */ t=((double)rand()/(double)RAND_MAX)*32255.; lseek(descriptor,(int)t,SEEK_SET); if(p) /* Use some VM as well */ { for(j=0;j<0xffff;j++) p[j]='Z'; free(p); p=NULL; } else { p=(char*)malloc(0xffff*sizeof(char)); if(!p) { printf("Cannot allocate memory, %d\n",incarnation); close(descriptor); exit(-1); } for(j=0;j<0xffff;j++) p[j]='z'; } } close(descriptor); if(p) free(p); wait(&status); return 0; } I ran at at one 2.1 box: AMD 5x86-133, ISA/PCI, 24M ram, 1.2G IDE hard disk, and at two 2.1.5 boxes: Pentium 100, ISA/PCI, 16M ram, Adaptec 7850 SCSI adapter, Seagate 2G SCSI hard disk, and Pentium 75, ISA/PCI, 16M ram, 1.2G hard disk. Each system crashes with message like: kernel page directory invalid pdir=0x52e063 va=0xc000 ^^^^^^^^ actual numbers may differ panic: invalid page directory Crash is more or less severe from time to time. Sometimes system will work well with 200 processes, but crash with 300 - it depends. I don't see any reason for such system behaviour. I'm not sure it's melfunction, but will be grateful to hear any comments. For we would like to use FreeBSD as a server for http, ftp, nntp, and other services, and we're very concerned with it's stability. I of course know that ftp.freebsd.org sustains very heavy load, but... At least, system should refuse to give servicies when overloaded, but (from my point of view) it shouldn't crash! P.S. May be the program is simply buggy - forgive the dummy in that case. -- Litvin Alexander +--------------------+ |"Must-die" must die!| +--------------------+