PostgreSQL hang On FreeBSD,with CFLAGS='-O2 -pthread' workaround

Jov amutu at
Tue Apr 15 01:24:22 UTC 2014

hi~ FreeBSD hackers,
I find some problems when use pg on FreeBSD.On FreeBSD,If installed
extension which pthread  lib is used,for example plv8,pljava,imcs etc,when
query touch these extenstions,the PG backend will hang.

there is a solution,which configure postgresql with CFLAGS='-O2 -pthread'
and compile pg from source ,then install the extension.But this solution is
not offical documented and not easy to use(you must compile pg from
source).It  may make some extension developers or user waste much time to
solve it,and make people complain that PG or FreeBSD not stable.

knizhnik has some insight:

> Actually I have already reproduced the problem with my lockbench test. It
> work when build as application with -pthread, but doesn't work if it built
> as shared library and loaded from application built without -pthread.
> Unfortunately I do not know other solution rather than rebuilt PostgreSQL
> with pthread. Sorry, that I have not informed you about my investigations
> and thank you for your help. I also run this test at OS/X - there is no
> such problem.

this is the ldd output:
[jovz@ ~]$ ldd pgsql_pthread/bin/postgres
pgsql/bin/postgres: => /lib/ (0x800cd1000) => /lib/ (0x800ef7000) => /lib/ (0x80111c000)
[jovz@ ~]$ ldd pgsql934/bin/postgres
pgsql934/bin/postgres: => /lib/ (0x800cd1000) => /lib/ (0x800ef7000)

the output make me remember some talk about sshd Zombie recently, which
something aoubt libc and libthr.

is this a known problem with FreeBSD pthread implement?


blog: <>

More information about the freebsd-questions mailing list