Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Sep 1998 16:45:00 +0200 (SAT)
From:      Graham Wheeler <gram@cdsec.com>
To:        hackers@FreeBSD.ORG
Subject:   Re: FreeBSD hanging/rebooting
Message-ID:  <199809181445.QAA03398@cdsec.com>

next in thread | raw e-mail | index | archive | help
While this may or may not be related to the other problems we are 
experiencing, I just ran a test program of mine that used to crash
2.2.2 and noticed that it still crashes 2.2.7. I posted a similar
program a long time back; clearly the problem that it reveals still
exists.

When run as root, this program forks child processes until the
system runs out of swap space, after which it is killed by a signal.
The entire O/S then hangs. Alt-F1 etc still works to change VTs,
but nothing else works, and a hard reset is needed.

#include <unistd.h>
#include <stdlib.h>

#define MAXPROC	2000

main()
{
    int pids[MAXPROC], i;
    for (i = 0; i < MAXPROC; i++)
    {
	pids[i] = fork();
	if (pids[i] < 0)
	{
	    perror("fork");
	    break;
	}
	else if (pids[i] == 0) /* child */
	{
	    sleep(60);
	    exit(0);
	}
	else printf("%d\n", i);
    }
    sleep(30);
}

-- 
Dr Graham Wheeler                          E-mail: gram@cdsec.com
Citadel Data Security                      Phone:  +27(21)23-6065/6/7
Internet/Intranet Network Specialists      Mobile: +27(83)253-9864
Firewalls/Virtual Private Networks         Fax:    +27(21)24-3656
Data Security Products                     WWW:    http://www.cdsec.com/




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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