Re: libpq thread safety - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: libpq thread safety
Date
Msg-id 200403141408.i2EE81d05929@candle.pha.pa.us
Whole thread Raw
In response to Re: libpq thread safety  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: libpq thread safety  (Manfred Spraul <manfred@colorfullife.com>)
List pgsql-hackers
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
compilingthis program.Add this to your template/$port
file:STRERROR_THREADSAFE=yesGETPWUID_THREADSAFE=yesGETHOSTBYNAME_THREADSAFE=yes

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: libpq thread safety
Next
From: Manfred Spraul
Date:
Subject: Re: libpq thread safety