openbsd, plpython, missing threading symbols

Started by Andrew Dunstanover 20 years ago9 messages
#1Andrew Dunstan
andrew@dunslane.net

Did we recently make some fixes for FBSD that cured the problem with
unresolved pthread* symbols for plpython? If so, should we look at
possibly doing something similar for OpenBSD? That might clean up
buildfarm member spoonbill which has been failing ever since we started
testing PLs. Stefan has upgraded the buildfarm code on this machine so
we can now see all the logs from tha various buildfarm stages, if that
is any help.

cheers

andrew

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: openbsd, plpython, missing threading symbols

Andrew Dunstan <andrew@dunslane.net> writes:

Did we recently make some fixes for FBSD that cured the problem with
unresolved pthread* symbols for plpython?

No, it's not fixed. I think the owner of the freebsd buildfarm machine
masked the problem by building an unthreaded libpython.

The only fix that so far looks like it would work is to build the
backend with threading (CPPFLAGS += -D_THREAD_SAFE and LIBS += -pthread,
IIUC). This seems sufficiently invasive that I'm quite loath to do it.
Does anyone have a handle on the likely performance and stability costs
of doing this on BSDen?

The alternative is to say that plpython isn't supported on BSDen unless
you choose to build an unthreaded libpython. Unpleasant as that may be,
I do not care for the proposition that plpython gets to dictate our
choice of libc. Whatever costs are incurred by that will be paid by
people who are not even using plpython, and that's not the direction
I want to see the pain flowing in.

regards, tom lane

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: openbsd, plpython, missing threading symbols

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

Did we recently make some fixes for FBSD that cured the problem with
unresolved pthread* symbols for plpython?

No, it's not fixed. I think the owner of the freebsd buildfarm machine
masked the problem by building an unthreaded libpython.

The only fix that so far looks like it would work is to build the
backend with threading (CPPFLAGS += -D_THREAD_SAFE and LIBS += -pthread,
IIUC). This seems sufficiently invasive that I'm quite loath to do it.
Does anyone have a handle on the likely performance and stability costs
of doing this on BSDen?

The alternative is to say that plpython isn't supported on BSDen unless
you choose to build an unthreaded libpython. Unpleasant as that may be,
I do not care for the proposition that plpython gets to dictate our
choice of libc. Whatever costs are incurred by that will be paid by
people who are not even using plpython, and that's not the direction
I want to see the pain flowing in.

I'm OK with that, but if that's what's done I think we should check for
it up front at configure time and not let it fail at run time like we do
now.

cheers

andrew

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#3)
Re: openbsd, plpython, missing threading symbols

Andrew Dunstan <andrew@dunslane.net> writes:

Tom Lane wrote:

The alternative is to say that plpython isn't supported on BSDen unless
you choose to build an unthreaded libpython.

I'm OK with that, but if that's what's done I think we should check for
it up front at configure time and not let it fail at run time like we do
now.

If you can create a suitable configure test, it'd be fine with me.

regards, tom lane

#5Stefan Kaltenbrunner
stefan@kaltenbrunner.cc
In reply to: Tom Lane (#4)
Re: openbsd, plpython, missing threading symbols

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

Tom Lane wrote:

The alternative is to say that plpython isn't supported on BSDen unless
you choose to build an unthreaded libpython.

I'm OK with that, but if that's what's done I think we should check for
it up front at configure time and not let it fail at run time like we do
now.

If you can create a suitable configure test, it'd be fine with me.

Not sure if it is of any help but mod_python seems to be using this
configure.in snippet to detect (and reject) a threaded python installation:

# check if python is compiled with threads
AC_MSG_CHECKING(whether Python is compiled with thread support)
PyTHREADS=`$PYTHON_BIN -c "import sys; print \"thread\" in
sys.builtin_module_names"`
if test "$PyTHREADS" = "1"; then
AC_MSG_RESULT(yes)
echo
echo " ****** WARNING ******"
echo " Python is compiled with thread support. Apache 1.3 does not
use threads."
echo " On some systems this will cause problems during compilation,
on others "
echo " it may result in unpredictable behaviour of your Apache
server. Yet on"
echo " others it will work just fine. The recommended approach is to
compile"
echo " Python without thread support in a separate location and
specify it with"
echo " --with-python option to this ./configure script."
echo
else
AC_MSG_RESULT([no threads, good])
fi

Stefan

#6Marko Kreen
marko@l-t.ee
In reply to: Stefan Kaltenbrunner (#5)
1 attachment(s)
Re: openbsd, plpython, missing threading symbols

On Thu, Aug 04, 2005 at 08:14:51PM +0200, Stefan Kaltenbrunner wrote:

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

Tom Lane wrote:

The alternative is to say that plpython isn't supported on BSDen unless
you choose to build an unthreaded libpython.

I'm OK with that, but if that's what's done I think we should check for
it up front at configure time and not let it fail at run time like we do
now.

If you can create a suitable configure test, it'd be fine with me.

Not sure if it is of any help but mod_python seems to be using this
configure.in snippet to detect (and reject) a threaded python installation:

Ok, I converted this to patch against config/python.m4.

Also made it work with python 2.3, 2.4 that return 'True' not '1'.

The error is thrown only on BSD's. As I understand threaded
python works fine on other OS'es?

Error message may need clarifying.

--
marko

Attachments:

pythread.difftext/plain; charset=us-asciiDownload
Index: config/python.m4
===================================================================
RCS file: /projects/cvsroot/pgsql/config/python.m4,v
retrieving revision 1.11
diff -c -c -r1.11 python.m4
*** config/python.m4	11 Oct 2004 19:32:16 -0000	1.11
--- config/python.m4	4 Aug 2005 19:43:45 -0000
***************
*** 77,80 ****
--- 77,95 ----
  AC_SUBST(python_libdir)[]dnl
  AC_SUBST(python_libspec)[]dnl
  AC_SUBST(python_additional_libs)[]dnl
+ 
+ # threaded python is not supported on bsd's
+ AC_MSG_CHECKING(whether Python is compiled with thread support)
+ pythreads=`${PYTHON} -c "import sys; print int('thread' in sys.builtin_module_names)"`
+ if test "$pythreads" = "1"; then
+   AC_MSG_RESULT(yes)
+   case $host_os in
+   *bsd*)
+     AC_MSG_ERROR([*** Threaded python not supported ***])
+     ;;
+   esac
+ else
+   AC_MSG_RESULT(no)
+ fi
+ 
  ])# PGAC_CHECK_PYTHON_EMBED_SETUP
#7Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Marko Kreen (#6)
Re: openbsd, plpython, missing threading symbols

Where are we going with this patch? It doesn't test specific OS's known
to fail.

---------------------------------------------------------------------------

Marko Kreen wrote:

On Thu, Aug 04, 2005 at 08:14:51PM +0200, Stefan Kaltenbrunner wrote:

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

Tom Lane wrote:

The alternative is to say that plpython isn't supported on BSDen unless
you choose to build an unthreaded libpython.

I'm OK with that, but if that's what's done I think we should check for
it up front at configure time and not let it fail at run time like we do
now.

If you can create a suitable configure test, it'd be fine with me.

Not sure if it is of any help but mod_python seems to be using this
configure.in snippet to detect (and reject) a threaded python installation:

Ok, I converted this to patch against config/python.m4.

Also made it work with python 2.3, 2.4 that return 'True' not '1'.

The error is thrown only on BSD's. As I understand threaded
python works fine on other OS'es?

Error message may need clarifying.

--
marko

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#8Marko Kreen
marko@l-t.ee
In reply to: Bruce Momjian (#7)
1 attachment(s)
Re: openbsd, plpython, missing threading symbols

On Fri, Aug 12, 2005 at 10:27:16PM -0400, Bruce Momjian wrote:

Where are we going with this patch? It doesn't test specific OS's known
to fail.

I hoped people more familiar with the problem would tune it...

Here is updated patch where I test specifically
'openbsd*|freebsd*' instead of '*bsd*'. Although
AFAIK all BSD's use similar libc/libc_r setup so
*bsd* should have been fine.

Also I 'clarified' the error message a bit.

There is one notable feature of this patch - it will check
for threaded Python on all platforms and print the result,
this hopefully helps tracking problems on other platforms too.

--
marko

Attachments:

pythread2.difftext/plain; charset=us-asciiDownload
Index: config/python.m4
===================================================================
RCS file: /opt/arc/cvs2/pgsql/config/python.m4,v
retrieving revision 1.11
diff -u -r1.11 python.m4
--- config/python.m4	11 Oct 2004 19:32:16 -0000	1.11
+++ config/python.m4	13 Aug 2005 09:13:29 -0000
@@ -77,4 +77,19 @@
 AC_SUBST(python_libdir)[]dnl
 AC_SUBST(python_libspec)[]dnl
 AC_SUBST(python_additional_libs)[]dnl
+
+# threaded python is not supported on bsd's
+AC_MSG_CHECKING(whether Python is compiled with thread support)
+pythreads=`${PYTHON} -c "import sys; print int('thread' in sys.builtin_module_names)"`
+if test "$pythreads" = "1"; then
+  AC_MSG_RESULT(yes)
+  case $host_os in
+  openbsd*|freebsd*)
+    AC_MSG_ERROR([*** Threaded Python not supported on this platform ***])
+    ;;
+  esac
+else
+  AC_MSG_RESULT(no)
+fi
+
 ])# PGAC_CHECK_PYTHON_EMBED_SETUP
#9Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Marko Kreen (#8)
Re: openbsd, plpython, missing threading symbols

Patch applied. Thanks.

---------------------------------------------------------------------------

Marko Kreen wrote:

On Fri, Aug 12, 2005 at 10:27:16PM -0400, Bruce Momjian wrote:

Where are we going with this patch? It doesn't test specific OS's known
to fail.

I hoped people more familiar with the problem would tune it...

Here is updated patch where I test specifically
'openbsd*|freebsd*' instead of '*bsd*'. Although
AFAIK all BSD's use similar libc/libc_r setup so
*bsd* should have been fine.

Also I 'clarified' the error message a bit.

There is one notable feature of this patch - it will check
for threaded Python on all platforms and print the result,
this hopefully helps tracking problems on other platforms too.

--
marko

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073