From owner-freebsd-bugs@FreeBSD.ORG Wed May 25 06:10:10 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 96CCD16A41C for ; Wed, 25 May 2005 06:10:10 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 669B243D4C for ; Wed, 25 May 2005 06:10:10 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4P6AAPM016066 for ; Wed, 25 May 2005 06:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4P6AAnN016061; Wed, 25 May 2005 06:10:10 GMT (envelope-from gnats) Date: Wed, 25 May 2005 06:10:10 GMT Message-Id: <200505250610.j4P6AAnN016061@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: David Xu Cc: Subject: Re: gnu/77818: GDB locks in wait4() when running applications X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: David Xu List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2005 06:10:10 -0000 The following reply was made to PR gnu/77818; it has been noted by GNATS. From: David Xu To: bug-followup@freebsd.org, sean-freebsd@farley.org Cc: Subject: Re: gnu/77818: GDB locks in wait4() when running applications Date: Wed, 25 May 2005 14:08:51 +0800 > > > I have a new test program[1] that I think shows the problem. My > previous program actually showed another bug that has since been fixed. > Actually, it shows two problems. When run within the debugger > (SHELL=3D/bin/sh gdb a.out), the parent will be stuck waiting for a signal > it will never receive in sigsuspend(). > Please try following patch, I believe the old hack is incorrect now with jhb's sleep queue. Index: kern_thread.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v retrieving revision 1.215 diff -u -r1.215 kern_thread.c --- kern_thread.c 23 Apr 2005 02:32:31 -0000 1.215 +++ kern_thread.c 25 May 2005 06:01:00 -0000 @@ -929,14 +929,6 @@ p->p_suspcount++; TD_SET_SUSPENDED(td); TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq); - /* - * Hack: If we are suspending but are on the sleep queue - * then we are in msleep or the cv equivalent. We - * want to look like we have two Inhibitors. - * May already be set.. doesn't matter. - */ - if (TD_ON_SLEEPQ(td)) - TD_SET_SLEEPING(td); } void > The other problem is that nanosleep() is exiting immediately with a > return of zero although the time to sleep has not passed. To see it do > this, remove the BROKEN_NANOSLEEP_WITHIN_GDB definition at the top of > the program and recompile. > This is a long history bug, I believe it is still in RELENG_4. Now the bug is in kern_sig.c: do_tdsignal(), when process is being debugged, a masked signal can wake up a sleeping thread! that's why it is broken. David Xu