From owner-freebsd-threads@FreeBSD.ORG Tue Jan 29 20:59:02 2008 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E203616A41A; Tue, 29 Jan 2008 20:59:01 +0000 (UTC) (envelope-from landonf@bikemonkey.org) Received: from secure.bikemonkey.org (bluefish.bikemonkey.org [69.80.211.101]) by mx1.freebsd.org (Postfix) with ESMTP id C000F13C4E1; Tue, 29 Jan 2008 20:59:01 +0000 (UTC) (envelope-from landonf@bikemonkey.org) Received: from [192.168.54.11] (unknown [192.168.54.11]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by secure.bikemonkey.org (Postfix) with ESMTP id 631F21707F; Tue, 29 Jan 2008 12:33:05 -0800 (PST) In-Reply-To: References: <200801240850.m0O8o2JQ023500@freefall.freebsd.org> <4798564B.7070500@elischer.org> Mime-Version: 1.0 (Apple Message framework v753) Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-6--6718150" Message-Id: <488DBC6A-CF33-4E50-B1BB-C396C8957F92@bikemonkey.org> From: Landon Fuller Date: Tue, 29 Jan 2008 12:33:01 -0800 To: Daniel Eischen Content-Transfer-Encoding: 7bit X-Pgp-Agent: GPGMail 1.1.2 (Tiger) X-Mailer: Apple Mail (2.753) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-threads@freebsd.org Subject: Re: threads/119920: fork broken in libpthread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2008 20:59:02 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-6--6718150 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jan 24, 2008, at 07:08, Daniel Eischen wrote: > On Thu, 24 Jan 2008, Julian Elischer wrote: > >> Gary Stanley wrote: >>> The following reply was made to PR threads/119920; it has been >>> noted by >>> GNATS. >>> >>> From: Gary Stanley >>> To: bug-followup@FreeBSD.org >>> Cc: Subject: Re: threads/119920: fork broken in libpthread >>> Date: Thu, 24 Jan 2008 03:24:47 -0500 >>> >>> I also have this problem, see threads/118715 >>> I was able to grab some ktrace info, but most of the time the >>> process is >>> stuck, and ktrace doesn't display any data. >>> _______________________________________________ >>> freebsd-threads@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-threads >>> To unsubscribe, send any mail to "freebsd-threads- >>> unsubscribe@freebsd.org" >> >> dan what IS the fix for this? I assume you must have fixed it in - >> current/7 > > You want cvs diff -u -r1.126 -r1.128 src/lib/libkse/thread/thr_kern.c. > The WARNS'ify diffs are not necessary, so it should look something > like shown below. Probably an MFC of all of libkse (minus jasone's > malloc changes) should be done to -7 and -6. There appears to be a remaining issue I'm still seeing locally, with the above patch; I wasn't able to reproduce this on 6.2: #0 0x0000000800648b13 in mutex_lock_common (curthread=0x0, m=0x8007616e8, abstime=0x0) at /usr/src/lib/libpthread/thread/ thr_mutex.c:503 #1 0x000000080064ac25 in _pthread_mutex_lock (m=0x8007616e8) at /usr/ src/lib/libpthread/thread/thr_mutex.c:868 #2 0x000000080063e9ce in _spinlock (lck=0x8009ac200) at /usr/src/lib/ libpthread/thread/thr_spinlock.c:97 #3 0x00000008007eafc3 in pubrealloc (ptr=0x0, size=24, func=0x8008802b7 " in malloc():") at /usr/src/lib/libc/stdlib/ malloc.c:1090 #4 0x00000008007eb1e1 in malloc (size=24) at /usr/src/lib/libc/ stdlib/malloc.c:1150 #5 0x000000080065ab8c in _lockuser_init (lu=0x52e068, priv=0x52e000) at /usr/src/lib/libpthread/sys/lock.c:99 #6 0x000000080065ac69 in _lockuser_reinit (lu=0x52e068, priv=0x52e000) at /usr/src/lib/libpthread/sys/lock.c:128 #7 0x000000080064d6d0 in _kse_single_thread (curthread=0x50cc00) at / usr/src/lib/libpthread/thread/thr_kern.c:343 #8 0x000000080063b627 in _fork () at /usr/src/lib/libpthread/thread/ thr_fork.c:101 #9 0x00000000004008f1 in forker () #10 0x000000080064516e in thread_start (curthread=0x50cc00, start_routine=0x4008e0 , arg=0x0) at /usr/src/lib/libpthread/ thread/thr_create.c:341 #11 0x00000008007b3cd9 in makectx_wrapper (ucp=0x800530860, func=0x800645150 , args=0x7fffff7fcfd0) at /usr/src/lib/ libc/amd64/gen/makecontext.c:100 #12 0x0000000000000000 in ?? () #13 0x000000000050cc00 in ?? () #14 0x00000000004008e0 in frame_dummy () via this reproduction case: #include #include #include 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-6--6718150 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) iD8DBQFHn419lplZCE/15mMRApnPAJ46HOR3yxe63AKFJRzw9F6bK5vbhwCfbVzK 5Dvl/hOzdh37iQtcJkGaf+E= =POmG -----END PGP SIGNATURE----- --Apple-Mail-6--6718150--