Re: TCL fix in HEAD - Mailing list pgsql-patches

From Marshall, Steve
Subject Re: TCL fix in HEAD
Date
Msg-id 4700EFB9.8080903@wsi.com
Whole thread Raw
In response to Re: TCL fix in HEAD  (Bruce Momjian <bruce@momjian.us>)
Responses Re: TCL fix in HEAD
List pgsql-patches
Bruce Momjian wrote:

>Marshall, Steve wrote:
>
>
>>>The recent TCL patch assumed Tcl_NotifierProcs.initNotifierProc
>>>was added in TCL 8.2:
>>>In fact it was added in 8.4 so I have modified the CVS with
>>>the following patch.
>>>
>>>
>>I confirmed this against the 8.2.5 release.  Sorry I did not notice that
>>when I initially created the patch.
>>
>>While the patch will not work for the earlier releases, it should be
>>noted that the multithhreading problem still exists when linking
>>postgresql against TCL 8.2 and 8.3 libraries that are compiled with the
>>preprocessor symbol TCL_THREADS defined.  Unfortunately, we cannot
>>override the initNotifier behavior in those releases, so we don't have a
>>workable solution.
>>
>>This is probably not a big problem, since TCL was not commonly compiled
>>with multithreading enabled prior to 8.4.  However, perhaps there should
>>be a warning in the documentation on PL/TCL directing users to avoid
>>linking postgresql against TCL libraries earlier than 8.4 that have
>>multithreading enabled?
>>
>>
>
>Can you send in a patch against pltcl.sgml?
>
>
PL/TCL documentation patch is attached.

*** pltcl.sgml    2007-10-01 08:29:06.667578247 -0400
--- pltcl.sgml.new    2007-10-01 08:24:41.736708719 -0400
***************
*** 70,75 ****
--- 70,87 ----
      <literal>createlang pltcl <replaceable>dbname</></literal> or
      <literal>createlang pltclu <replaceable>dbname</></literal>.
     </para>
+    <para>
+     Care should be taken when linking the pltcl shared object code against
+     TCL libraries earlier than the TCL 8.4 release.  The pre-8.4 versions of TCL must
+     be built <emphasis>without</emphasis> multithreading support, i.e. with TCL_THREADS
+     undefined.  Otherwise, the first use of PL/TCL functions will cause the postgres
+     backend to become multithreaded, resulting in subsequent "unexpected state" errors.
+     PL/TCL <emphasis>can</emphasis> be safely linked against multithreaded versions of the
+     TCL library for TCL versions 8.4 and later.  In these cases, the pltcl source code uses
+     capabilities introduced in TCL 8.4 to override and disable the multithreading behavior.
+     Note that pre-8.4 versions of TCL were rarely built with multithreading support in
+     pre-compiled distributions, so this problem is rather rare.
+    </para>
    </sect1>

    <!-- **** PL/Tcl description **** -->

pgsql-patches by date:

Previous
From: "Hiroshi Saito"
Date:
Subject: 64bit compile linker problem of win32.mak.
Next
From: Magnus Hagander
Date:
Subject: Re: OpenSSL Applink