Date: Thu, 4 Mar 1999 11:48:47 +0100 From: Marc Olzheim <marcolz@stack.nl> To: freebsd-stable@FreeBSD.ORG Subject: DOS with ktrace Message-ID: <19990304114847.A1201@stack.nl>
next in thread | raw e-mail | index | archive | help
Hi.
When ktracing the following prog, FreeBSD 2.2.8 sometimes produces a deadlock
situation.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
extern int
main (int argc, char **argv)
{
char buffer[1000000];
int result;
if (fcntl(1, F_SETFL, O_NONBLOCK))
err(1, "fcntl(1, F_SETFL, O_NONBLOCK)");
bzero(buffer, sizeof(buffer));
strcpy(buffer, "hoihoihoihoihoi!");
for (;;)
{
result = write(1, buffer, sizeof(buffer));
if (result == -1)
warn("write(1, buffer, %d)", sizeof(buffer));
else if (result == 0)
errx(1, "result == 0");
else if (result != sizeof(buffer))
errx(1, "result == %d", result);
}
argc = 0; argv = NULL;
return 0;
}
Just compile it and run it as:
ktrace -t cnsw ./testwrite > /tmp/foo
Then suspend it with ^Z
Any process trying to do filesystem-io will wait in locks. On a busy machine
it will soon run out of resources.
This does not happen 100% of the time, but it's very well reproducable, just
try one or two times.
I have no FreeBSD 3 boxes here yet to test it on, so I don't know wether it's
affected or not, but it does affect 2.2.6 (i.e. non-CAM).
Marc
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990304114847.A1201>
