Trying to track down some memory corruption problems I found: http://www.linuxfromscratch.org/blfs/view/stable/server/postgresql.html and the postgresql configure flag "--enable-thread-safety". Is there any reason why this flag isn't being used in the postgresql ebuilds? Without this it would appear that stuff like php and slony will suffer from memory corruption under multi-threaded usage.
USE='threads' enables the --enable-thread-safety
There is no threads USE flag in postgresql-8 ebuilds, only postgresql-7: % grep threads *.ebuild postgresql-7.3.10.ebuild:IUSE="doc java libg++ nls pam perl python readline ssl tcltk zlib threads selinux" postgresql-7.3.10.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.3.11.ebuild:IUSE="doc java libg++ nls pam perl python readline ssl tcltk zlib threads selinux" postgresql-7.3.11.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.3.12.ebuild:IUSE="doc java libg++ nls pam perl python readline ssl tcltk zlib threads selinux" postgresql-7.3.12.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.3.9-r1.ebuild:IUSE="doc java libg++ nls pam perl python readline ssl tcltk zlib threads selinux" postgresql-7.3.9-r1.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.4.10.ebuild:IUSE="ssl nls java python tcltk perl libg++ pam readline zlib doc pg-hier pg-vacuumdelay pg-intdatetime threads xml2 selinux" postgresql-7.4.10.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.4.7-r1.ebuild:IUSE="ssl nls java python tcltk perl libg++ pam readline zlib doc pg-hier pg-vacuumdelay pg-intdatetime threads xml2 selinux" postgresql-7.4.7-r1.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.4.7-r2.ebuild:IUSE="ssl nls java python tcltk perl libg++ pam readline zlib doc pg-hier pg-vacuumdelay pg-intdatetime threads xml2 selinux" postgresql-7.4.7-r2.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.4.8.ebuild:IUSE="ssl nls java python tcltk perl libg++ pam readline zlib doc pg-hier pg-vacuumdelay pg-intdatetime threads xml2 selinux" postgresql-7.4.8.ebuild: use threads && myconf="$myconf --enable-thread-safety" postgresql-7.4.9.ebuild:IUSE="ssl nls java python tcltk perl libg++ pam readline zlib doc pg-hier pg-vacuumdelay pg-intdatetime threads xml2 selinux" postgresql-7.4.9.ebuild: use threads && myconf="$myconf --enable-thread-safety" Also for libpq I noticed this in the output: checking allow thread-safe client libraries... no Doesn't libpq need to be thread safe as well? It has no threads USE flag either: % emerge -vp libpq These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] dev-db/libpq-8.0.4 -kerberos +nls -pam +readline +ssl +zlib 0 kB
As I understand it, postgresql isn't multi-threaded, so only libpq needs to be thread safe and the threads USE flag present in the postgresql-7 ebuilds is actually useless.
From postgresql HISTORY: "libpq and ECPG applications are now fully thread-safe While previous libpq releases already supported threads, this release improves thread safety by fixing some non-thread-safe code that was used during database connection startup. The "configure" option "--enable-thread-safety" must be used to enable this feature." Since this bug has been hanging around for a while and it only affects threads users, I've gone ahead and commited -r1 ebuilds for postgresql and libpq that re-add the threads use flag so that libpq and ecpg are built with thread support. I can't be bothered to fix all the older ebuilds :-/ I hope this is ok. Note as mentioned on http://www.dbtalk.net/mailing-database-pgsql-bugs/re-bugs-general-problems-building-146015.html I've had to add the -opt package to libpq SRC_URI. It can be removed in postgresql-8.2.