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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jov <amutu(at)amutu(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostgreSQL hang on FreeBSD,with CFLAGS='-O2 -pthread' workaround
Date: 2014-04-15 01:52:40
Message-ID: 11613.1397526760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jov <amutu(at)amutu(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-04-15 01:53:46 pgsql: Add TAP tests for client programs
Previous Message Andrew Dunstan 2014-04-15 01:49:43 Re: assertion failure 9.3.4