Thread: ECPG still having thread problems

ECPG still having thread problems

From
Philip Yarra
Date:
Hi all, it looks like Lee's ECPG (and libpq) thread-safety patches
have been applied, and configure --with-threads is also added. I
have been doing some testing, and I still encounter a
threading problem.

I have done the following:
1) cvs update
2) ./configure --with-threads && make && su -c "make install"
3) compiled cn.pgc as follows:       a) ecpg -t cn.pgc       b) gcc -I/usr/local/pgsql/include -L/usr/local/pgsql/lib \
             -lecpg -lpgtypes -lpthread cn.c 
4) ./a.out - one thread runs to completion (inserts 5 records),       the other hangs (manages one insert, then blocks
forever)

Using gdb, I attached to the LWP that has locked up, and the backtrace
looks like this:

(gdb) backtrace
#0  0x420e0187 in poll () from /lib/i686/libc.so.6
#1  0x4007d8cc in pqSocketPoll () from /usr/local/pgsql/lib/libpq.so.3
#2  0x4007d7ed in pqSocketCheck () from /usr/local/pgsql/lib/libpq.so.3
#3  0x4007d71f in pqWaitTimed () from /usr/local/pgsql/lib/libpq.so.3
#4  0x4007d6f5 in pqWait () from /usr/local/pgsql/lib/libpq.so.3
#5  0x4007bb53 in PQgetResult () from /usr/local/pgsql/lib/libpq.so.3
#6  0x4007bcbb in PQexec () from /usr/local/pgsql/lib/libpq.so.3
#7  0x40026d81 in ECPGexecute () from /usr/local/pgsql/lib/libecpg.so.4
#8  0x4002724c in ECPGdo () from /usr/local/pgsql/lib/libecpg.so.4
#9  0x08048927 in ins2 ()
#10 0x40043faf in pthread_start_thread () from /lib/i686/libpthread.so.0

(The other threads are waiting to pthread_join)

I'd really appreciate it if someone could try this sample app to
confirm whether I am doing something wrong, or my environment is
faulty, or if there is still a thread problem.

Build env:
Linux 2.4.18-3
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)

Philip Yarra.

Re: ECPG still having thread problems - follow-up

From
Philip Yarra
Date:
On Wed, 18 Jun 2003 02:58 pm, Philip Yarra wrote:
> Hi all, it looks like Lee's ECPG (and libpq) thread-safety patches
> have been applied, and configure --with-threads is also added. I
> have been doing some testing, and I still encounter a
> threading problem.

For those interested, I tested this on FreeBSD 4.8, and it works fine (as in,
no threads hang). I'm not sure what to make of that. Sounds like something
more might be required for pthreads on Linux.

Regards, Philip.