From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | wespvp(at)syntegra(dot)com |
Cc: | joseph speigle <joe(dot)speigle(at)jklh(dot)us>, PostgreSQL <pgsql-general(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: thread_test.c problems |
Date: | 2004-04-05 04:22:03 |
Message-ID: | 200404050422.i354M3P05375@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
wespvp(at)syntegra(dot)com wrote:
> On 4/4/04 7:28 PM, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
>
> > OK, I know the cause of this. The problem is that sometimes hostnames
> > don't resolve, and the bigger problem is that it requires an internet
> > connection to run the tests. The attached patch tests for 'localhost'
> > and your local hostname, so it should work reliably.
>
> I did a cvs update, make, then rebuilt and tested thread_test. I ran it
> about 120 times and got "GETHOSTBYNAME_THREADSAFE=yes" almost all of the
> time. I got "GETHOSTBYNAME_THREADSAFE=no" three times. The other two were
> always "yes".
Yep, I can reproduce this on BSD/OS too, so it must be something wrong
with my program. I see:
$ for X in `jot 1000`; do thread_test |grep -10 '=no' && echo $X;
done|less
Make sure you have added any needed 'THREAD_CPPFLAGS' and 'THREAD_LIBS'
defines to your template/$port file before compiling this program.
Add this to your template/$port file:
STRERROR_THREADSAFE=yes
GETPWUID_THREADSAFE=no
GETHOSTBYNAME_THREADSAFE=no
919
I bet the problem is that I am accessing thread-specific pointers after
the thread exits. It is possible thread 1 completes before thread2 gets
to the getpwuid and gethostbyname tests, and then reuses the
thread-specific pointer. Let me work on a patch and email it to you in
a few minutes.
> I did verify that both the "volatile" and "localhost" changes were in there.
>
> Dumb question... Why would you not always use the _r functions if they
> exist?
Yes, we do use *_r functions in 7.5 if they exist, but in 7.4.X, I think
we use the non-R if we can, though we actually just use getaddrinfo() in
7.4.X if it exists. Basically, the threading tests are still in flux,
as you can see, in 7.4.X. It works, but it isn't 100% configure perfect
yet.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | wespvp | 2004-04-05 04:55:57 | Re: thread_test.c problems |
Previous Message | Tom Lane | 2004-04-05 02:50:11 | Re: RPM init-script: Why the locale setting? |
From | Date | Subject | |
---|---|---|---|
Next Message | wespvp | 2004-04-05 04:55:57 | Re: thread_test.c problems |
Previous Message | Tom Lane | 2004-04-05 02:44:55 | Re: Solaris initdb fails: shmmax tweak alternative? |