Re: libpq thread safety

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq thread safety
Date: 2004-03-14 14:08:01
Message-ID: 200403141408.i2EE81d05929@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Manfred Spraul wrote:
> Bruce Momjian wrote:
>
> >Your patch has been added to the PostgreSQL unapplied patches list at:
> >
> > http://momjian.postgresql.org/cgi-bin/pgpatches
> >
> >I will try to apply it within the next 48 hours.
> >
> >
> You are too fast: the patch was a proof of concept, not really tested
> (actually quite buggy).
> Attached are two patches:
>
> - ready-sigpipe: check_sigpipe_handler skips pthread_create_key if a
> signal handler was installed. This is wrong - the key is always required.
> - ready-locking: locking around kerberos and openssl.
>
> The patches pass the regression tests on i386 linux. Kerberos is
> untested, ssl only partially tested due to the lack of a test setup.
> I'm still not sure if the new code is the right thing for the openssl
> initialization: libpq calls SSL_library_init() unconditionally. If the
> calling app uses ssl, too, this might confuse openssl.

How can we test if libpq needs to call that? Seems that is an issue
whether we are threaded or not, no?

> Could you replace my initial proposal with these two patches?

Done.

> Btw, is it intentional that THREAD_SUPPORT is not set in src/template/linux?

There is a new test program in src/tools/thread that needs to be run for
every platform for 7.5. We can't use the 7.4.X tests because it didn't
report individual function tests, just one general value. We need
individual test reports for 7.5. Run the test program and post the
results and I will get it updated. The test output on my bsd/os machine
is:

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=yes
GETHOSTBYNAME_THREADSAFE=yes

--
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-03-14 14:10:25 Re: ECPG - Remove need for "AT connection" when using threads
Previous Message Bruce Momjian 2004-03-14 14:03:47 Re: libpq thread safety

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-03-14 14:10:14 Re: ECPG: Update tests & memory leak fix
Previous Message Bruce Momjian 2004-03-14 14:03:47 Re: libpq thread safety