Re: [HACKERS] Threads

From: Don Baccus <dhogaza(at)pacifier(dot)com>
To: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, Ross J Reedstrom <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Threads
Date: 1999-08-04 11:20:30
Message-ID: 3.0.1.32.19990804042030.00b0f3bc@mail.pacifier.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 07:56 PM 8/3/99 -0400, Lamar Owen wrote:
>Tom Lane wrote:
>> PQconnectdb() is the function that's not thread-safe; if you had
>> multiple threads invoking PQconnectdb() in parallel you would see a
>> problem. PQconndefaults() is the function that creates an API problem,
>> because it exposes the static variable that PQconnectdb() ought not have
>> had in the first place.
>>
>> There might be some other problems too, but that's the main one I'm
>> aware of. If we didn't mind breaking existing apps that use
>> PQconndefaults(), it would be straightforward to fix...
>
>Oh, this is interesting. I've been pointer and thread chasing for the
>last few hours trying to figure out why AOLserver (a multithreaded open
>source web server that supports pooled database (inluding postgresql)
>connections) doesn't hit this snag -- and I haven't yet found the
>answer...

AOLserver rarely does a connect once the server gets fired up and
receives traffic. It may be that actual db connects are
guarded by semaphores or the like. It may be that conflicts are
rare because on a busy site a connection will be made once and only
once and later lives on in the pool forever, with the handle being
allocated and released by individual .tcl scripts and .adp pages.

- Don Baccus, Portland OR <dhogaza(at)pacifier(dot)com>
Nature photos, on-line guides, and other goodies at
http://donb.photo.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 1999-08-04 12:52:15 RE: [HACKERS] Threads
Previous Message Adriaan Joubert 1999-08-04 06:00:02 Re: [HACKERS] Mariposa