Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2000 10:50:19 -0800
From:      "Brian O'Shea" <boshea@ricochet.net>
To:        Randall Hopper <aa8vb@ipass.net>
Cc:        Tom <tom@uniserve.com>, stable@FreeBSD.ORG
Subject:   Re: Dynamic linker bug in 3.4-RELEASE (I think)
Message-ID:  <20000319105019.D78517@beastie.localdomain>
In-Reply-To: <20000318110118.A34149@ipass.net>; from Randall Hopper on Sat, Mar 18, 2000 at 11:01:18AM -0500
References:  <20000317195156.A24243@ipass.net> <Pine.BSF.4.05.10003171652210.25933-100000@shell.uniserve.ca> <20000318110118.A34149@ipass.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <pid>
with your shell's PID (which you got above).

$ fstat -p <pid>

-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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000319105019.D78517>