From owner-freebsd-stable Sun Mar 19 10:40:41 2000 Delivered-To: freebsd-stable@freebsd.org Received: from mail.rdc1.sfba.home.com (ha1.rdc1.sfba.home.com [24.0.0.66]) by hub.freebsd.org (Postfix) with ESMTP id E73CA37B5BC for ; Sun, 19 Mar 2000 10:40:36 -0800 (PST) (envelope-from boshea@ricochet.net) Received: from beastie.localdomain ([24.19.158.41]) by mail.rdc1.sfba.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <20000319184036.OJOK14939.mail.rdc1.sfba.home.com@beastie.localdomain>; Sun, 19 Mar 2000 10:40:36 -0800 Received: (from brian@localhost) by beastie.localdomain (8.9.3/8.8.7) id KAA33086; Sun, 19 Mar 2000 10:50:19 -0800 (PST) (envelope-from brian) Date: Sun, 19 Mar 2000 10:50:19 -0800 From: "Brian O'Shea" To: Randall Hopper Cc: Tom , stable@FreeBSD.ORG Subject: Re: Dynamic linker bug in 3.4-RELEASE (I think) Message-ID: <20000319105019.D78517@beastie.localdomain> Mail-Followup-To: Randall Hopper , Tom , stable@FreeBSD.ORG References: <20000317195156.A24243@ipass.net> <20000318110118.A34149@ipass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <20000318110118.A34149@ipass.net>; from Randall Hopper on Sat, Mar 18, 2000 at 11:01:18AM -0500 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, Mar 18, 2000 at 11:01:18AM -0500, Randall Hopper wrote: > Tom: > |On Fri, 17 Mar 2000, Randall Hopper wrote: > |> I have a small program I wrote that uses sigwait and takes about 1 second > |> to complete. > |> > |> If I run it over-and-over many times repeatedly, occasionally the dynamic > |> linker will fail to resolve the "sigwait" symbol. > ... > |> Done > |> Done > |> /usr/libexec/ld-elf.so.1: hw4-1: Undefined symbol "sigwait" > |> Done > |> Done > ... > | > | I think it is more likely you are exceeding your limit on number of file > |descriptors, so the dynamic linker isn't able to open the libraries. > > How could that be? The program opens one file and one pipe. So that's > 5 file descriptors. I think that Tom is referring to the fact that the shell opens /dev/null a bunch of times (with the redirection operator in a while-loop), and each child process of the shell inherits the open file descriptors of its parent. He is suggesting that, once this gets close enough to the maximum number of open files, the next child process that is created will exceed the limit of open files, and will then have trouble opening shared libraries. However, I don't think that this is what's going on here since in each iteration of the while-loop, the shell waits for its child to exit before starting the next iteration (and it should be closing /dev/null in the parent process after each fork() system call). It could be a shell bug (if the shell isn't closing the open files from the redirection after the fork). To test this, you could try running fstat on the shell process while the script is running to see how many times it has /dev/null open. The fstat program doesn't show file names, it will only tell you that there are open files in / (/dev/null is in the / filesystem), so it might be useful to run this command before and during the while-loop and compare the output from both times). To get the PID of your shell process, run the following command in the terminal where you will be running your program. You will be passing this PID to fstat later: $ echo $$ (run your program in a while-loop from this terminal, as you described before) Now in another terminal, run the following command, replacing with your shell's PID (which you got above). $ fstat -p -brian -- Brian O'Shea boshea@ricochet.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message