Re: [HACKERS] libpq thread safety

2004-05-26 Thread Bruce Momjian
Tom Lane wrote: > Manfred Spraul <[EMAIL PROTECTED]> writes: > > But what about kerberos: I'm a bit reluctant to add a forth mutex: what > > if kerberos calls gethostbyname or getpwuid internally? > > Wouldn't help anyway, if some other part of the app also calls kerberos. > I think we should jus

Re: [HACKERS] libpq thread safety

2004-03-14 Thread Manfred Spraul
Bruce Momjian wrote: How can we test if libpq needs to call that? Seems that is an issue whether we are threaded or not, no? I think it's always an issue: in the non-threaded case, it's just not fatal. At least some openssl init functions are protected with "if (done) return; done = 1;", and

Re: [HACKERS] libpq thread safety

2004-03-14 Thread Bruce Momjian
Patch withdrawn by author. --- Manfred Spraul wrote: > 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 acces

Re: [HACKERS] libpq thread safety

2004-03-14 Thread Manfred Spraul
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

Re: [HACKERS] libpq thread safety

2004-03-13 Thread Bruce Momjian
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. --- Manfred Spraul wrote: > Bruce Momjian wro

Re: [HACKERS] libpq thread safety

2004-03-13 Thread Bruce Momjian
Manfred Spraul wrote: > 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 > impleme

Re: [HACKERS] libpq thread safety

2004-03-12 Thread Manfred Spraul
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

Re: [HACKERS] libpq thread safety

2004-03-10 Thread Bruce Momjian
Bruce Momjian wrote: > Manfred Spraul wrote: > > Hi, > > > > I've searched through libpq and looked for global or static variables as > > indicators of non-threadsafe code. I found: > > - Win32 and BeOS: there is a global "ioctlsocket_ret variable, but it > > seems to be a dummy variable that is

Re: [HACKERS] libpq thread safety

2004-02-11 Thread Bruce Momjian
Manfred Spraul wrote: > libpq needs additional changes for complete thread safety: > - openssl needs different initialization. > - kerberos is not thread safe. > - functions such as gethostbyname are not thread safe, and could be used > by kerberos. Right now protected with a libpq specific mutex

Re: [HACKERS] libpq thread safety

2004-02-11 Thread Bruce Momjian
Manfred Spraul wrote: > Bruce Momjian wrote: > > >However, we really have two types of function tested. > >The first, strerror, can be thread safe by using thread-local storage > >_or_ by returning pointers to static strings. The other two function > >tests require thread-local storage to be thr

Re: [HACKERS] libpq thread safety

2004-02-10 Thread Manfred Spraul
Bruce Momjian wrote: However, we really have two types of function tested. The first, strerror, can be thread safe by using thread-local storage _or_ by returning pointers to static strings. The other two function tests require thread-local storage to be thread-safe. You are completely ignori

Re: [HACKERS] libpq thread safety

2004-02-10 Thread Bruce Momjian
Manfred Spraul wrote: > Tom Lane wrote: > > >Wait a minute. I am *not* buying into any proposal that we need to > >support ENABLE_THREAD_SAFETY on machines where libc is not thread-safe. > >We have other things to do than adopt an open-ended commitment to work > >around threading bugs on obsolete

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Tom Lane
Manfred Spraul <[EMAIL PROTECTED]> writes: > I'd agree - convince Bruce and I'll replace the mutexes in thread.c with > #error. Most of what I said before was aimed at Bruce ;-) > But I think libpq should support a mutex around kerberos (or at > least fail at runtime) - right now it's too easy

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Manfred Spraul
Tom Lane wrote: Wait a minute. I am *not* buying into any proposal that we need to support ENABLE_THREAD_SAFETY on machines where libc is not thread-safe. We have other things to do than adopt an open-ended commitment to work around threading bugs on obsolete platforms. I don't believe that any

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Tom Lane
Manfred Spraul <[EMAIL PROTECTED]> writes: > + * Used to set callback that prevents concurrent access to > + * non-thread safe functions that libpq needs. > + * The default implementation uses a libpq internal mutex. > + * Only required for multithreaded apps on platforms that > + * do no

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Manfred Spraul
Tom Lane wrote: Personally I find diff -u format completely unreadable :-(. Send "diff -c" if you want useful commentary. diff -c is attached. I've removed the signal changes, they are unrelated. I'll resent them separately. -- Manfred Index: src/interfaces/libpq/libpq-fe.h ==

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Tom Lane
Manfred Spraul <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Wouldn't help anyway, if some other part of the app also calls kerberos. >> > That's why I've proposed to use the system from openssl: The libpq user > must implement a lock callback, and libpq calls it around the critical > section

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Manfred Spraul
Tom Lane wrote: Manfred Spraul <[EMAIL PROTECTED]> writes: But what about kerberos: I'm a bit reluctant to add a forth mutex: what if kerberos calls gethostbyname or getpwuid internally? Wouldn't help anyway, if some other part of the app also calls kerberos. That's why I've proposed to

Re: [HACKERS] libpq thread safety

2004-01-11 Thread Tom Lane
Manfred Spraul <[EMAIL PROTECTED]> writes: > But what about kerberos: I'm a bit reluctant to add a forth mutex: what > if kerberos calls gethostbyname or getpwuid internally? Wouldn't help anyway, if some other part of the app also calls kerberos. I think we should just state that kerberos isn't

[HACKERS] libpq thread safety

2004-01-11 Thread Manfred Spraul
libpq needs additional changes for complete thread safety: - openssl needs different initialization. - kerberos is not thread safe. - functions such as gethostbyname are not thread safe, and could be used by kerberos. Right now protected with a libpq specific mutex. - dito for getpwuid and stderr

Re: [HACKERS] libpq thread safety

2003-11-17 Thread Bruce Momjian
Manfred Spraul wrote: > Hi, > > I've searched through libpq and looked for global or static variables as > indicators of non-threadsafe code. I found: > - Win32 and BeOS: there is a global "ioctlsocket_ret variable, but it > seems to be a dummy variable that is always discarded. Right, and it i

[HACKERS] libpq thread safety

2003-11-17 Thread Manfred Spraul
Hi, I've searched through libpq and looked for global or static variables as indicators of non-threadsafe code. I found: - Win32 and BeOS: there is a global "ioctlsocket_ret variable, but it seems to be a dummy variable that is always discarded. - pg_krb4_init(): Are the kerberos libraries threa