Skip site navigation (1) Skip section navigation (2)

ECPG still having thread problems on Linux

From: Philip Yarra <philip(at)utiba(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: ECPG still having thread problems on Linux
Date: 2003-06-24 08:25:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-interfaces
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.

On FreeBSD 4.8, the attached sample app runs without a problem.

However, I still encounter a threading problem on Linux (RedHat 7.3).

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 -pthread 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 thread that has locked up, and the backtrace
looks like this:

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

Can anyone shed some light on why the behaviour differs between these two 

Also, perhaps someone other there with access to a different Linux setup 
(maybe a more recent build than RedHat 7.3, or a different distro) could try 
this app themselves to help verify if this is something that's stuffed on 
that release. I think I can rule out this problem being a quirk of my 
particular setup, as 3 different machines (all running RH7.3) give identical 

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

Regards, Philip Yarra.

Attachment: cn.pgc
Description: text/x-csrc (1.4 KB)


pgsql-hackers by date

Next:From: Dave PageDate: 2003-06-24 08:26:08
Subject: Re: ftp mirror
Previous:From: Karel ZakDate: 2003-06-24 08:04:13
Subject: Re: TO_CHAR SO SLOW???

pgsql-interfaces by date

Next:From: The Hermit HackerDate: 2003-06-25 02:46:24
Subject: libpgtcl and pgtclsh
Previous:From: Nic FerrierDate: 2003-06-24 00:46:18
Subject: emarsden's pg.scm for guile (with some extensions)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group