Date: Thu, 3 Aug 2006 09:24:53 GMT From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: FreeBSD-gnats-submit@FreeBSD.org Subject: threads/101323: fork(2) in threaded programs broken. Message-ID: <200608030924.k739OrJ1016406@critter.freebsd.dk> Resent-Message-ID: <200608031740.k73HeFxg008801@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 101323 >Category: threads >Synopsis: fork(2) in threaded programs broken. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 03 17:40:15 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Poul-Henning Kamp >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: System: FreeBSD critter.freebsd.dk 7.0-CURRENT FreeBSD 7.0-CURRENT #5: Wed Jul 5 22:14:32 UTC 2006 root@critter.freebsd.dk:/critter/obj/critter/src/sys/TP41P i386 >Description: Forking a threaded process and starting a thread in the child process does not work. Tested on -current and releng_6 and both fails with more or less the same error message: Fatal error 'mutex is on list' at line 540 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0) >How-To-Repeat: #include <pthread.h> #include <stdio.h> void * thr_sleeper(void *arg) { (void)arg; while (1) { printf("%d\n", getpid()); sleep (1); } } int main(int argc, char **argv) { pthread_t t1, t2; (void)argc; (void)argv; pthread_create(&t1, NULL, thr_sleeper, NULL); if (!fork()) { pthread_create(&t2, NULL, thr_sleeper, NULL); while(1) sleep(1); } while(1) sleep(1); } >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608030924.k739OrJ1016406>