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

Started by Jovover 11 years ago2 messages
#1Jov
amutu@amutu.com

hi~ pg 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.

Is it a PG problem and can we fix it?

I will also report this to the FreeBSD mail list.

ref:
/messages/by-id/534785D2.6050105@matrix.gatewaynet.com

https://github.com/knizhnik/imcs/issues/25

http://code.google.com/p/plv8js/issues/detail?id=34

Jov
blog: http:amutu.com/blog <http://amutu.com/blog&gt;

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jov (#1)
Re: PostgreSQL hang on FreeBSD,with CFLAGS='-O2 -pthread' workaround

Jov <amutu@amutu.com> writes:

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.

Is it a PG problem and can we fix it?

Sounds more like a bug with FreeBSD's libc and/or libpthread.

In general, we do not and will not support any third-party code that
causes multiple threads to become instantiated inside a PG backend.
So long as these libraries aren't actually forking new threads, you'd
think the presence of libpthread in them would be a non-issue. It
sounds like the mere presence of libpthread may be changing behavior
somewhere, which I would argue to be a bug in either libpthread or
whatever is changing behavior.

As for building PG itself with -pthread: not bloody likely. That
would send *entirely* the wrong message about whether threading
is permitted.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers