From: "Ted Ts'o" <tytso@mit.edu>
To: Tim Pepper <tpepper@gmail.com>
Cc: util-linux@vger.kernel.org
Subject: Re: libuuid clock.txt fd leaks
Date: Wed, 21 Sep 2011 16:26:20 -0400 [thread overview]
Message-ID: <20110921202620.GD4056@thunk.org> (raw)
In-Reply-To: <CAHuv5K=UXH=vMZoCgYYvucACru5D8dLa91ufVeY2GJFFSv1ckw@mail.gmail.com>
On Wed, Sep 21, 2011 at 09:58:21AM -0700, Tim Pepper wrote:
> The sourceforge.net link above includes a number of suggested options.
> And there's also just the simple implementation option for
> get_clock() that doesn't have the fd as static much less TLS and
> opens/closes at each invocation. That maybe comes with a noticable
> performance hit for some types of users and I don't really know the
> full list of possible use cases here...do some people really need that
> high performance uuid generation? Either way, the "right" general
> solution isn't immediately obvious to me so I thought I'd see what
> others here thought...
Part of the problem is that the uuid library was originally designed
non-thread-using libraries, and I originally was trying to force all
programs to link against -lpthread. (Remember, libuuid as found in
e2fsprogs predates Linux having a standardized threads support, or any
threads support at all.)
Personally, I think threads are evil, and avoid them like the plague,
so I'm not up on the latest threads requirements, but at least at one
point, if a shared library used threads all of the programs that
called said shared library had to link against pthreads and #include
pthread.h, and have errno redefined, etc. (Remember we need to worry
about making things work both for the static and shared linking case.)
So the reason why I put in THREAD_LOCAL was it was the simplest way to
avoid problems without having access to mutexes and without having to
drag in the whole posix threads mess and inflicting it on all of
libuuid's callers.
Unfortunately, it didn't occur to me that people would write programs
where they spawned jillions of threads and then abandon them, causing
the fd leak that would eventually kill the program. (See my belief
that Posix Threads are evil.)
It may be that the right answer is to create a separate library which
is used for threading programs --- or develop a completely thread-safe
API for threaded progams, and keep the old API for
sane^H^H^H^Hsingle-threaded programs.
- Ted
next prev parent reply other threads:[~2011-09-21 20:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 16:58 libuuid clock.txt fd leaks Tim Pepper
2011-09-21 20:26 ` Ted Ts'o [this message]
2011-09-21 21:15 ` Ted Ts'o
2011-09-21 22:02 ` Tim Pepper
2011-09-21 22:19 ` Tim Pepper
2011-09-21 22:24 ` Ted Ts'o
2011-09-21 22:32 ` Tim Pepper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110921202620.GD4056@thunk.org \
--to=tytso@mit.edu \
--cc=tpepper@gmail.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox