Thread: ECPG thread-safety

ECPG thread-safety

From
Lee Kindness
Date:
Philip,

You can find the "patch so far" at:
http://services.csl.co.uk/postgresql/

along with a libpq thread-safe patch.

The thread referenced by Bruce's email details some of the issues
still to be looked at. The main work is integration with the build
system (testing for and linking in POSIX threads) and testing.

I'm more than happy for you to look at at, I haven't had the time I
hoped to complete this.

Thanks, Lee.

Philip Yarra writes:> As I found out recently, ECPG is not thread-safe. This is a problem for us, as > we really need
tobe able to use ECPG* in a multi-threaded C application. > Michael mentioned that Lee is working on fixing these
problems,but was not > sure when it would be complete. > > So, my questions are: > Lee/anyone, do you have an estimated
completiondate? > If not, can we (myself plus a "real" C programmer) help you?> > Regards, Philip Yarra.> > * Yes, we
coulduse libpq, but ECPG minimises our porting from Informix. > Rewriting everything to use libpq would be too
expensive.>
 



Re: ECPG thread-safety

From
Bruce Momjian
Date:
I have the libpq patch in my mailbox that just needs configure thread
testing code.  I will get that in for 7.4.

---------------------------------------------------------------------------

Lee Kindness wrote:
> Philip,
> 
> You can find the "patch so far" at:
> 
>  http://services.csl.co.uk/postgresql/
> 
> along with a libpq thread-safe patch.
> 
> The thread referenced by Bruce's email details some of the issues
> still to be looked at. The main work is integration with the build
> system (testing for and linking in POSIX threads) and testing.
> 
> I'm more than happy for you to look at at, I haven't had the time I
> hoped to complete this.
> 
> Thanks, Lee.
> 
> Philip Yarra writes:
>  > As I found out recently, ECPG is not thread-safe. This is a problem for us, as 
>  > we really need to be able to use ECPG* in a multi-threaded C application. 
>  > Michael mentioned that Lee is working on fixing these problems, but was not 
>  > sure when it would be complete. 
>  > 
>  > So, my questions are: 
>  > Lee/anyone, do you have an estimated completion date? 
>  > If not, can we (myself plus a "real" C programmer) help you?
>  > 
>  > Regards, Philip Yarra.
>  > 
>  > * Yes, we could use libpq, but ECPG minimises our porting from Informix. 
>  > Rewriting everything to use libpq would be too expensive.
>  > 
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 



Re: ECPG thread-safety

From
Larry Rosenman
Date:

--On Friday, March 28, 2003 10:54:23 -0500 Bruce Momjian 
<pgman@candle.pha.pa.us> wrote:

>
> I have the libpq patch in my mailbox that just needs configure thread
> testing code.  I will get that in for 7.4.
I can help with the UnixWare threads stuff.  Also, Micheal Meskes now has 
an account
on my UnixWare box.

The threads are native on UW, but you need to invoke the cc -Kpthread 
option.

LER

>
> -------------------------------------------------------------------------
> --
>
> Lee Kindness wrote:
>> Philip,
>>
>> You can find the "patch so far" at:
>>
>>  http://services.csl.co.uk/postgresql/
>>
>> along with a libpq thread-safe patch.
>>
>> The thread referenced by Bruce's email details some of the issues
>> still to be looked at. The main work is integration with the build
>> system (testing for and linking in POSIX threads) and testing.
>>
>> I'm more than happy for you to look at at, I haven't had the time I
>> hoped to complete this.
>>
>> Thanks, Lee.
>>
>> Philip Yarra writes:
>>  > As I found out recently, ECPG is not thread-safe. This is a problem
>>  > for us, as  we really need to be able to use ECPG* in a
>>  > multi-threaded C application.  Michael mentioned that Lee is working
>>  > on fixing these problems, but was not  sure when it would be
>>  > complete.
>>  >
>>  > So, my questions are:
>>  > Lee/anyone, do you have an estimated completion date?
>>  > If not, can we (myself plus a "real" C programmer) help you?
>>  >
>>  > Regards, Philip Yarra.
>>  >
>>  > * Yes, we could use libpq, but ECPG minimises our porting from
>>  > Informix.  Rewriting everything to use libpq would be too expensive.
>>  >
>>
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
> 19073
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



Re: ECPG thread-safety

From
Bruce Momjian
Date:
Would someone take those patches and hunt around for proper 'configure'
tests?  I can do the configure coding, but I don't know what tests to
make.
http://services.csl.co.uk/postgresql/


---------------------------------------------------------------------------

Larry Rosenman wrote:
> 
> 
> --On Friday, March 28, 2003 10:54:23 -0500 Bruce Momjian 
> <pgman@candle.pha.pa.us> wrote:
> 
> >
> > I have the libpq patch in my mailbox that just needs configure thread
> > testing code.  I will get that in for 7.4.
> I can help with the UnixWare threads stuff.  Also, Micheal Meskes now has 
> an account
> on my UnixWare box.
> 
> The threads are native on UW, but you need to invoke the cc -Kpthread 
> option.
> 
> LER
> 
> >
> > -------------------------------------------------------------------------
> > --
> >
> > Lee Kindness wrote:
> >> Philip,
> >>
> >> You can find the "patch so far" at:
> >>
> >>  http://services.csl.co.uk/postgresql/
> >>
> >> along with a libpq thread-safe patch.
> >>
> >> The thread referenced by Bruce's email details some of the issues
> >> still to be looked at. The main work is integration with the build
> >> system (testing for and linking in POSIX threads) and testing.
> >>
> >> I'm more than happy for you to look at at, I haven't had the time I
> >> hoped to complete this.
> >>
> >> Thanks, Lee.
> >>
> >> Philip Yarra writes:
> >>  > As I found out recently, ECPG is not thread-safe. This is a problem
> >>  > for us, as  we really need to be able to use ECPG* in a
> >>  > multi-threaded C application.  Michael mentioned that Lee is working
> >>  > on fixing these problems, but was not  sure when it would be
> >>  > complete.
> >>  >
> >>  > So, my questions are:
> >>  > Lee/anyone, do you have an estimated completion date?
> >>  > If not, can we (myself plus a "real" C programmer) help you?
> >>  >
> >>  > Regards, Philip Yarra.
> >>  >
> >>  > * Yes, we could use libpq, but ECPG minimises our porting from
> >>  > Informix.  Rewriting everything to use libpq would be too expensive.
> >>  >
> >>
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 359-1001
> >   +  If your life is a hard drive,     |  13 Roberts Road
> >   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
> > 19073
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
> 
> 
> 
> -- 
> Larry Rosenman                     http://www.lerctr.org/~ler
> Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
> US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
> 
> 
> 
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 



Re: ECPG thread-safety

From
Larry Rosenman
Date:

--On Friday, March 28, 2003 11:00:47 -0500 Bruce Momjian 
<pgman@candle.pha.pa.us> wrote:

>
> Would someone take those patches and hunt around for proper 'configure'
> tests?  I can do the configure coding, but I don't know what tests to
> make.
>
>     http://services.csl.co.uk/postgresql/
I do know there are configure tests built for UnixWare's pthreads, but I 
don't know where.  I have seen them invoked as I've compiled stuff.

Also, once you compile a piece with -Kpthread you must compile ALL of it 
with -Kpthread.

You are welcome to read the UnixWare docs at http://www.lerctr.org:8458/ or 
on the SCO site.


>
>
> -------------------------------------------------------------------------
> --
>
> Larry Rosenman wrote:
>>
>>
>> --On Friday, March 28, 2003 10:54:23 -0500 Bruce Momjian
>> <pgman@candle.pha.pa.us> wrote:
>>
>> >
>> > I have the libpq patch in my mailbox that just needs configure thread
>> > testing code.  I will get that in for 7.4.
>> I can help with the UnixWare threads stuff.  Also, Micheal Meskes now
>> has  an account
>> on my UnixWare box.
>>
>> The threads are native on UW, but you need to invoke the cc -Kpthread
>> option.
>>
>> LER
>>
>> >
>> > ----------------------------------------------------------------------
>> > --- --
>> >
>> > Lee Kindness wrote:
>> >> Philip,
>> >>
>> >> You can find the "patch so far" at:
>> >>
>> >>  http://services.csl.co.uk/postgresql/
>> >>
>> >> along with a libpq thread-safe patch.
>> >>
>> >> The thread referenced by Bruce's email details some of the issues
>> >> still to be looked at. The main work is integration with the build
>> >> system (testing for and linking in POSIX threads) and testing.
>> >>
>> >> I'm more than happy for you to look at at, I haven't had the time I
>> >> hoped to complete this.
>> >>
>> >> Thanks, Lee.
>> >>
>> >> Philip Yarra writes:
>> >>  > As I found out recently, ECPG is not thread-safe. This is a problem
>> >>  > for us, as  we really need to be able to use ECPG* in a
>> >>  > multi-threaded C application.  Michael mentioned that Lee is
>> >>  > working on fixing these problems, but was not  sure when it would
>> >>  > be complete.
>> >>  >
>> >>  > So, my questions are:
>> >>  > Lee/anyone, do you have an estimated completion date?
>> >>  > If not, can we (myself plus a "real" C programmer) help you?
>> >>  >
>> >>  > Regards, Philip Yarra.
>> >>  >
>> >>  > * Yes, we could use libpq, but ECPG minimises our porting from
>> >>  > Informix.  Rewriting everything to use libpq would be too
>> >>  > expensive.
>> >>  >
>> >>
>> >
>> > --
>> >   Bruce Momjian                        |  http://candle.pha.pa.us
>> >   pgman@candle.pha.pa.us               |  (610) 359-1001
>> >   +  If your life is a hard drive,     |  13 Roberts Road
>> >   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
>> > 19073
>> >
>> >
>> > ---------------------------(end of
>> > broadcast)--------------------------- TIP 6: Have you searched our
>> > list archives?
>> >
>> > http://archives.postgresql.org
>> >
>>
>>
>>
>> --
>> Larry Rosenman                     http://www.lerctr.org/~ler
>> Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
>> US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
>>
>>
>>
>>
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
> 19073



-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



Re: ECPG thread-safety

From
Shridhar Daithankar
Date:
On Friday 28 March 2003 21:30, you wrote:
> Would someone take those patches and hunt around for proper 'configure'
> tests?  I can do the configure coding, but I don't know what tests to
> make.
>
>     http://services.csl.co.uk/postgresql/

I also need configure tests for thread for one of my other application and 
don't know how to put them. So I have left those as additional ldflags 
options to users.

I suggest we somehow test following config to start with

1) Linuxthreads on linux
Threads are usually installed in /usr/ So pthread.h and -lpthread should work 
on most setups.

2) Native freeBSD threads
pthread.h in /usr/include and lc_r

3)linuxthreads on freeBSD, ports collection
/usr/local/include/pthreads/linuxthreads/pthread.h
/usr/local/lib/libpthread.so

For testing the library, I think it is enough to init an thread attr. like 
pthread_init_attr, that should be enough to test header and library.

I don't how we are going to let people specify thread implementation where 
there are multiple thread libraries are available .e.g. freeBSD.

HTH
Shridhar



Re: ECPG thread-safety

From
Lee Kindness
Date:
I must have spent at least a day looking at configure threads tests
the past few months. Look at the tests in Python, OpenLDAP, MySQL,
Apache 2.0, Perl, ... each and everyone of them is different!
Ouch. Way above my experience in configure.

One of the packages (sorry cannot find my notes on which one!) I
looked at down the test on a per-OS level - supplying the tread
compile and link flags used on that OS and CC to see if they
worked... Probably the simplest way to go?

L.

Bruce Momjian writes:> > Would someone take those patches and hunt around for proper 'configure'> tests?  I can do the
configurecoding, but I don't know what tests to> make.> >     http://services.csl.co.uk/postgresql/> > >
--------------------------------------------------------------------------->> Larry Rosenman wrote:> > > > > > --On
Friday,March 28, 2003 10:54:23 -0500 Bruce Momjian > > <pgman@candle.pha.pa.us> wrote:> > > > >> > > I have the libpq
patchin my mailbox that just needs configure thread> > > testing code.  I will get that in for 7.4.> > I can help with
theUnixWare threads stuff.  Also, Micheal Meskes now has > > an account> > on my UnixWare box.> > > > The threads are
nativeon UW, but you need to invoke the cc -Kpthread > > option.> > > > LER> > > > >> > >
------------------------------------------------------------------------->> > --> > >> > > Lee Kindness wrote:> > >>
Philip,>> >>> > >> You can find the "patch so far" at:> > >>> > >>  http://services.csl.co.uk/postgresql/> > >>> > >>
alongwith a libpq thread-safe patch.> > >>> > >> The thread referenced by Bruce's email details some of the issues> >
>>still to be looked at. The main work is integration with the build> > >> system (testing for and linking in POSIX
threads)and testing.> > >>> > >> I'm more than happy for you to look at at, I haven't had the time I> > >> hoped to
completethis.> > >>> > >> Thanks, Lee.> > >>> > >> Philip Yarra writes:> > >>  > As I found out recently, ECPG is not
thread-safe.This is a problem> > >>  > for us, as  we really need to be able to use ECPG* in a> > >>  > multi-threaded
Capplication.  Michael mentioned that Lee is working> > >>  > on fixing these problems, but was not  sure when it would
be>> >>  > complete.> > >>  >> > >>  > So, my questions are:> > >>  > Lee/anyone, do you have an estimated completion
date?>> >>  > If not, can we (myself plus a "real" C programmer) help you?> > >>  >> > >>  > Regards, Philip Yarra.> >
>> >> > >>  > * Yes, we could use libpq, but ECPG minimises our porting from> > >>  > Informix.  Rewriting everything
touse libpq would be too expensive.> > >>  >> > >>> > >> > > --> > >   Bruce Momjian                        |
http://candle.pha.pa.us>> >   pgman@candle.pha.pa.us               |  (610) 359-1001> > >   +  If your life is a hard
drive,    |  13 Roberts Road> > >   +  Christ can be your backup.        |  Newtown Square, Pennsylvania> > > 19073> >
>>> >> > > ---------------------------(end of broadcast)---------------------------> > > TIP 6: Have you searched our
listarchives?> > >> > > http://archives.postgresql.org> > >> > > > > > > > -- > > Larry Rosenman
http://www.lerctr.org/~ler>> Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org> > US Mail: 1905 Steamboat
SpringsDrive, Garland, TX 75044-6749> > > > > > > > > > -- >   Bruce Momjian                        |
http://candle.pha.pa.us>  pgman@candle.pha.pa.us               |  (610) 359-1001>   +  If your life is a hard drive,
|  13 Roberts Road>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
 



Re: ECPG thread-safety

From
Shridhar Daithankar
Date:
On Friday 28 March 2003 21:45, you wrote:
> For testing the library, I think it is enough to init an thread attr. like
> pthread_init_attr, that should be enough to test header and library.

And compiler flags, I forgot.. -pthread on freeBSD/gcc and -D_REENTRANT on 
linux at least. FreeBSD needs _THREAD_SAFE as well IIRC.
Shridhar



Re: ECPG thread-safety

From
Bruce Momjian
Date:
Yep.  I need someone who knows these OS's to get some tests together.

---------------------------------------------------------------------------

Shridhar Daithankar wrote:
> On Friday 28 March 2003 21:45, you wrote:
> > For testing the library, I think it is enough to init an thread attr. like
> > pthread_init_attr, that should be enough to test header and library.
> 
> And compiler flags, I forgot.. -pthread on freeBSD/gcc and -D_REENTRANT on 
> linux at least. FreeBSD needs _THREAD_SAFE as well IIRC.
> 
>  Shridhar
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 



Re: ECPG thread-safety

From
Manfred Spraul
Date:
Shridhar Daithankar wrote:

>2) Native freeBSD threads
>pthread.h in /usr/include and lc_r
>
>  
>
Do you know if FreeBSD supports pthread_rwlock with 
PTHREAD_PROCESS_SHARED? I'm trying to replace the LWLocks with 
pthread_rwlocks.

What about other Unices?
--   Manfred



Re: ECPG thread-safety

From
"Shridhar Daithankar"
Date:
On 1 Jun 2003 at 11:10, Manfred Spraul wrote:

> Shridhar Daithankar wrote:
> 
> >2) Native freeBSD threads
> >pthread.h in /usr/include and lc_r
> >
> >  
> >
> Do you know if FreeBSD supports pthread_rwlock with 
> PTHREAD_PROCESS_SHARED? I'm trying to replace the LWLocks with 
> pthread_rwlocks.
> 
> What about other Unices?

I am sorry for late reply. Hasn't been able to boot into freeBSD due to day job 
for weeks. I will check and let you know.

ByeShridhar

--
We'll pivot at warp 2 and bring all tubes to bear, Mr. Sulu!