Re: Threaded Python vs. PostGreSQL plpython

From: Mike Meyer <mwm(at)mired(dot)org>
To: shridhar_daithankar(at)persistent(dot)co(dot)in
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Threaded Python vs. PostGreSQL plpython
Date: 2003-03-25 16:04:17
Message-ID: 16000.32257.812298.28705@guru.mired.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In <3E803616(dot)19976(dot)2E2BDDB(at)localhost>, Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in> typed:
> On 24 Mar 2003 at 11:45, Mike Meyer wrote:

Just to clarify, the current situation is that I have things working,
but I also have a libpython.so that isn't threaded. I'm not happy
about the latter, and worry about rebuilding an embedded applications
and suddenly having my threaded scripots quit working because it
picked up the wrong library. I also have problems in that some modules
I should be able to import with plpython don't, because they are
linked against the wrong libc.

> > In <200303241039(dot)04880(dot)shridhar_daithankar(at)persistent(dot)co(dot)in>, "Shridhar Daithankar<shridhar_daithankar(at)persistent(dot)co(dot)in>" <shridhar_daithankar(at)persistent(dot)co(dot)in> typed:
> Now if you link libpython.so against linuxthreads, it *should* work perfectly
> with postgresql because linuxthreads library provides only thread functions.
> libc.so has none of them. So there is no chance of collision and it *should*
> work.
> Anyway this is just to get things linked against and running. You can not run
> threaded python apps with such a library because libc against which it is
> linked is not threaded or thread safe.

So this would be similar to my current solution - my real python would
be threaded and linked against libc_r, and I'd have a "special"
libpython.so that looked like it could be threaded, but in reality
couldn't because it uses linuxthreads and a not-thread-safe libc. This
is not an improvement - in fact, I'd say it's worse.

> OTOH, you can link postgresql and libpython.so with libc_r. That should work as
> well and you can use threads in python too. I would recommend this approach.

This was my second choice. I was hoping that someone would tell me
this was safe before I went to the trouble of trying it. Well, I was
hoping someone had a better solution than that, but if this works,
I'll do it this way.

Thank you,
<mike
--
Mike Meyer <mwm(at)mired(dot)org> http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabio Furia Silva 2003-03-25 16:12:00 Persistent variables between cross-calls in C functions
Previous Message Lee Kindness 2003-03-25 16:04:01 Bison 1.875 now required.