Re: libpq thread safety

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

Bruce Momjian wrote:

>What killed the idea of doing ssl or kerberos locking inside libpq was
>that there was no way to be sure that outside code didn't also access
>those routines.
>
A callback based implementation can handle that: libpq has a default
implementation for apps that do not use openssl or kerberos themself. If
the app wants to use the libraries, too, then it must replace the hooks
with their own locks.

I've attached a simple proposal, just for kerberos 4. If you agree on
the general approach, I'll add it to all functions that are not thread safe.

> I have documented that SSL and Kerberos are not
>thread-safe in the libpq docs. Let's wait and see If we need additional
>work in this area.
>
>
It means that multithreading is not usable: As Tom explained, the
connect string is often set directly by the end user. Setting "sslmode"
would result is races - impossible to support. In the very least,
sslmode and Kerberos would have to fail if the app is multithreaded.

--
Manfred

Attachment Content-Type Size
patch-krb4-lock text/plain 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fernando Nasser 2004-03-12 20:19:29 Re: Log rotation
Previous Message Robert Treat 2004-03-12 19:52:04 Re: [HACKERS] The Name Game: postgresql.net vs.

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-03-12 20:19:08 Re: Update tests & memory leak fix
Previous Message Lee Kindness 2004-03-12 17:24:01 Re: Update tests & memory leak fix