Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2008 11:03:06 -0800
From:      Landon Fuller <landonf@bikemonkey.org>
To:        Julian Elischer <julian@elischer.org>
Cc:        Daniel Eischen <deischen@freebsd.org>, Gary Stanley <gary@velocity-servers.net>, Robert Watson <rwatson@FreeBSD.org>, freebsd-threads@freebsd.org
Subject:   Re: threads/119920: fork broken in libpthread
Message-ID:  <42D09215-18FD-43A1-97E8-D4CC9E97AFDD@bikemonkey.org>
In-Reply-To: <47A2170D.6020308@elischer.org>
References:  <200801240850.m0O8o2JQ023500@freefall.freebsd.org>	<4798564B.7070500@elischer.org>	<Pine.GSO.4.64.0801240957550.16059@sea.ntplx.net>	<20080128185830.B56811@fledge.watson.org>	<479E3079.3000803@elischer.org>	<20080129222455.T53151@fledge.watson.org> <20080131093321.K35034@fledge.watson.org> <47A2170D.6020308@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--Apple-Mail-29-160686945
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


On Jan 31, 2008, at 10:44, Julian Elischer wrote:

> the releng 6 and releng 7 versions of this patch are at:
> http://www.freebsd.org/~julian/kse-6.diff
> and
> http://www.freebsd.org/~julian/kse-7.diff
>
> but the one for 7 is just speculative.
> I don't have a 7.x system to test.
>
> Landon, what is your test case?


Inlined below. On our 8-core 6.3 system without this patch, the fork 
() threads wedge and spin in <2 minutes. With the patch, works as  
expected.

#include <sys/types.h>
#include <unistd.h>
#include <pthread.h>

void *forker (void *arg) {
         while (1) {
                 pid_t pid = fork();
                 if (pid == 0) {
                         exit(0);
                 } else if (pid > 0) {
                         int status;
                         waitpid(pid, &status, 0);
                 } else {
                         printf("Fork failed\n");
                         abort();
                 }
         }
}

int main(void) {
         int i = 0;
         for (i = 0; i < 4; i++) {
                 pthread_t thr;
                 pthread_create(&thr, NULL, forker, NULL);
                 pthread_detach(thr);
         }

         while(1)
                 sleep(1000);
}
--Apple-Mail-29-160686945
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHohtqlplZCE/15mMRArX+AJ4l9gd9JiEkf8lUh+YfVKydeF//AACePCBf
oOVWV6RDLo9WpMnfFYlwsmY=
=5b3p
-----END PGP SIGNATURE-----

--Apple-Mail-29-160686945--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42D09215-18FD-43A1-97E8-D4CC9E97AFDD>