Re: weird buildfarm failures on arm/mipsel and --with-tcl - Mailing list pgsql-hackers

From Tom Lane
Subject Re: weird buildfarm failures on arm/mipsel and --with-tcl
Date
Msg-id 22677.1170020990@sss.pgh.pa.us
Whole thread Raw
In response to Re: weird buildfarm failures on arm/mipsel and --with-tcl  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: weird buildfarm failures on arm/mipsel and --with-tcl  (Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>)
List pgsql-hackers
I wrote:
> One possibility for fixing it is that maybe we should be making an
> effort to execute Tcl_Finalize() before exiting the backend.  If so,
> having pltcl set up an on_proc_exit callback to do it would be the
> appropriate thing.  This is all speculation though.

Just for grins I tried this, and I can see by strace'ing that it changes
the process-shutdown-time behavior quite a lot: the secondary thread now
exits first, apparently after being told to via a message from the
primary.  So I think this might indeed be something good to do.  Would
you try the attached patch and see if it changes the behavior on your
systems?  (This patch is very ugly and will draw compiler warnings, but
don't worry about that yet.)
        regards, tom lane

Index: pltcl.c
===================================================================
RCS file: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v
retrieving revision 1.108
diff -c -r1.108 pltcl.c
*** pltcl.c    4 Oct 2006 00:30:14 -0000    1.108
--- pltcl.c    28 Jan 2007 21:45:40 -0000
***************
*** 26,31 ****
--- 26,32 ---- #include "fmgr.h" #include "nodes/makefuncs.h" #include "parser/parse_type.h"
+ #include "storage/ipc.h" #include "tcop/tcopprot.h" #include "utils/builtins.h" #include "utils/lsyscache.h"
***************
*** 245,250 ****
--- 246,253 ----      ************************************************************/     if (!pltcl_be_init_done)     {
+             on_proc_exit(Tcl_Finalize, 0);
+          if (SPI_connect() != SPI_OK_CONNECT)             elog(ERROR, "SPI_connect failed");
pltcl_init_load_unknown(pltcl_norm_interp);


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Modifying and solidifying contrib
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Modifying and solidifying contrib