Postgres 7.4Beta2 Thread-safe

Поиск
Список
Период
Сортировка
От Thierry Missimilly
Тема Postgres 7.4Beta2 Thread-safe
Дата
Msg-id 3F5EDD68.1AE72FFC@BULL.NET
обсуждение исходный текст
Список pgsql-general
Hi,

I'm testing Postgresql-7.4beta2 on a RedHat 7.3 mono Pentium IV CPU machine. And i think i have a Thread-safe problem. PostgreSQL developpers will find a test program  to reproduce it on their lab.

I've built Postgresql with the option --enable-thread-safety --with-tcl.
And now run a pgbench like program call pgbch.pgc (attached with this mail).

The main differences of pgbch.pgc are :
1) Pro*c code
2) Multi-threaded
3) Some specific code for Oracle
4) Some specific dynamic trace for debug

To compile  :

ecpg -o pgbhc.c pgbch.pgc
cc -g -D_THREAD_SAFE -D_REENTRANT -I /usr/local/pgsql/include -L /usr/local/pgsql/lib -lpthread -lecpg -o pgbch pgbch.c

To execute :

pgbch -c3 -t10 -s10 base_s10

(you can add -d10 to have debug traces)

Well, the problem is that sometime pgbch hang. Run it 3 or 4 times and it will hang.
I don't know if it is really link to Postgres and ECPG but if you modifiy pgbch.pgc in the way that the transaction is limited to "BEGIN; END; ", it will never hang.

pgbch with 3 clients means 4 processes, but when then hang occurs, generally, one client has finished its 10 transactions and there still are 3 processes.

A look at gdb (gdb pgbch <pid>) gives (See the attach file pgbch.gdb) :
1) The main thread is in pthread_join() waitting for the 2 other child threads.
2) One thread has finished, but is hanged in pqSocketPoll()
3) The last other thread is waitting to start running in __pthread_manager()

Well, i'm not an expert in Linux multi-thread, but it seems the thread (2) is waitting from a message from the postgresql backend which never comes and therefore blocks the others threads.

I hope this will help to give back Postgres 7.4 more robust.

Regards,
Thierry Missimilly
 
 
 

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: "Bruno BAGUETTE"
Дата:
Сообщение: RE : How to convert a UnixTimestamp to a PostgreSQL date without using ::abstime ?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Temp tables and copy