Re: Threaded Python vs. PostGreSQL plpython - Mailing list pgsql-hackers

From Mike Meyer
Subject Re: Threaded Python vs. PostGreSQL plpython
Date
Msg-id 16000.32257.812298.28705@guru.mired.org
Whole thread Raw
In response to Re: Threaded Python vs. PostGreSQL plpython  ("Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>)
List pgsql-hackers
In <3E803616.19976.2E2BDDB@localhost>, Shridhar Daithankar <shridhar_daithankar@persistent.co.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.04880.shridhar_daithankar@persistent.co.in>, "Shridhar
Daithankar<shridhar_daithankar@persistent.co.in>"    <shridhar_daithankar@persistent.co.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@mired.org>        http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



pgsql-hackers by date:

Previous
From: Nick Piggin
Date:
Subject: Re: IO scheduler vs PostgreSQL performance measurement
Next
From: "Fabio Furia Silva"
Date:
Subject: Persistent variables between cross-calls in C functions