From owner-freebsd-hackers@FreeBSD.ORG Fri May 13 17:45:15 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0630E16A4CE; Fri, 13 May 2005 17:45:15 +0000 (GMT) Received: from mail.farley.org (farley.org [67.64.95.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80D3943D5F; Fri, 13 May 2005 17:45:14 +0000 (GMT) (envelope-from sean-freebsd@farley.org) Received: from thor.farley.org (thor.farley.org [IPv6:2001:470:1f01:290:1::5]) by mail.farley.org (8.13.1/8.13.1) with ESMTP id j4DHjAMS058462; Fri, 13 May 2005 12:45:10 -0500 (CDT) (envelope-from sean-freebsd@farley.org) Received: from localhost (localhost [127.0.0.1]) by thor.farley.org (8.13.3/8.13.3) with ESMTP id j4DHjCjd011851; Fri, 13 May 2005 12:45:13 -0500 (CDT) (envelope-from sean-freebsd@farley.org) Date: Fri, 13 May 2005 12:45:12 -0500 (CDT) From: =?ISO-8859-1?Q?Se=E1n_C=2E_Farley?= To: =?ISO-8859-1?Q?Herv=E9_Kergourlay?= In-Reply-To: <4284CFB5.7040805@atempo.com> Message-ID: <20050513123403.J11641@thor.farley.org> References: <428307A9.10901@atempo.com> <20050512134151.O2556@thor.farley.org> <20050512163409.O4283@thor.farley.org> <4284CFB5.7040805@atempo.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-254365337-1116006312=:11641" cc: Greg 'groggy' Lehey cc: hackers@freebsd.org cc: David Xu Subject: Re: Porting on FreeBSD 53 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 17:45:15 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-254365337-1116006312=:11641 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 13 May 2005, Herv=E9 Kergourlay wrote: > Se=E1n C. Farley a =E9crit : > >> On Thu, 12 May 2005, Se=E1n C. Farley wrote: >>=20 >>> On Thu, 12 May 2005, Herv=E9 Kergourlay wrote: >>>=20 >>> >>>=20 >>>> 4) wait() API >>>>=20 >>>> 2 problems, the first is a ECHILD error on a wait call after a fork >>>> fork The code is generic for most of unix system. Is there any >>>> specific problems to manage the fork and wait APIs ? the second >>>> problem with calls is a blocking wait() call in the same condition >>>> but this time the son process is finished but the wait call in the >>>> father stays blocked, again it's a generic Unix code >>>>=20 >>>> If there is no evidence, ask me for more informations >>>=20 >>>=20 >>> The second problem sounds like what I am encountering >>> (http://www.freebsd.org/cgi/query-pr.cgi?pr=3D77818) with zsh for my >>> shell. You did suspend (sigsuspend()) SIGCHLD before the fork? By >>> "fork fork", do you mean you fork twice? >>=20 >>=20 >> Ah ha! I see the problem that has been causing me this problem and >> probably you too. Signal suspensions (only these?) are not being >> copied with a double fork(). Here is an example program[1] to >> illustrate. They do get copied on FreeBSD-4.10 and Linux. I just do >> not know if they are supposed to be copied. >>=20 >> Se=E1n >>=20 >> P.S. I included David since he has been trying to help me with this >> bug. >>=20 >> 1. http://www.farley.org/freebsd/tmp/grandparent.c > > > I test your sample > > it's working on Linux and FreeBSD 4.0 but failing on FreeBDS 5.2 et > 5.3. the process stays blocked on the suspend call > > I rewrite another sample with the same model, joined here, as we wrote > it in our main program. It's working also on Linux but failing on all > FreeBSD included FreeBSD 4.0, 5.2 et 5.3 > > trace when working > > avant FORK : pid 71995. > avant FORK : pid 71996. > son pid 71997. > Child calling execve(/bin/ls). > sigw sigw.c sigw2 sigw2.c > Grand parent pid 71996. > Grand parent waiting for a signal. > Parent pid 71997. > Parent waiting for a signal. > Parent get status 100000. > Grand parent get status 100000. > > trace when failing > > avant FORK : pid 71995. > avant FORK : pid 71996. > son pid 71997. > Child calling execve(/bin/ls). > sigw sigw.c sigw2 sigw2.c > Grand parent pid 71996. > Grand parent waiting for a signal. > Parent pid 71997. > Parent waiting for a signal. > wait returned No child processes. > wait returned No child processes. > > the wait call return with an errno ECHILD ?? The children are exiting before the parents (due to sleep()'s) get to their wait()'s. > did you have any idea if the problem will be solve by the FreeBSD team > or not ? I updated my bug report and tried to notify David Xu but the e-mail server rejected the e-mail (too many "Received" headers). I am also Cc'ing Greg Lehey since he ran into a possibly similar bug[1] in February. > or if there is a workarouund ? Reapplying the sigsuspend() before each fork() may work. Se=E1n 1. http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/77537 --=20 sean-freebsd@farley.org --0-254365337-1116006312=:11641--