Removal of bogus gethostbyaddr_r()

Mike Makonnen mtm at identd.net
Thu Jun 19 19:33:50 PDT 2003


On Thu, 19 Jun 2003 21:40:26 -0400
Andriy Gapon <agapon at cv-nj.com> wrote:

> 
> Btw, what happened to the patch(es) proposed by Maxim Sobolev:
> http://docs.freebsd.org/cgi/getmsg.cgi?fetch=13028+0+archive/2002/freebsd-audit/20020818.freebsd-audit
> 
> and in Problem Report bin/29581:
> http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/29581
> 
> the discussion in the mailing lists seems to have resulted in nothing, and the
> problem seemed to be of non-unsolvable kind.

I am not so sure that using pthreads thread local storage is such a good idea
for a couple of reasons: 

1. There is a finite amount of keys that an application can have open at any
    one time (PTHREAD_KEYS_MAX). On FreeBSD this is 256. So, every key we
    create is one less the application can use. This is really only a minor   
    concern. Most applications don't use thread local storage and those that
    do don't usually need so many.

2. The order in which key destructors are called is not guaranteed. An
    application that uses pthreads thread local storage for its own reasons and
    calls one of the resolver routines from inside one of its destructors
    could get in trouble because the destructor for the resolver routines
    was called before its own. This would almost certainly lead to a memory
    leak in the application.

However, these reservations are not show-stoppers since they can be
easily mitigated by a mention in the appropriate man pages.

Cheers.
-- 
Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm at identd.net | D228 1A6F C64E 120A A1C9  A3AA DAE1 E2AF DBCC 68B9
mtm at FreeBSD.Org| FreeBSD - The Power To Serve


More information about the freebsd-threads mailing list