Tk Source Code

View Ticket
Login
Ticket UUID: 597847
Title: panic with thread-enabled Tcl
Type: Bug Version: obsolete: 8.5a0
Submitter: dgp Created on: 2002-08-20 17:16:48
Subsystem: 84. Unix Build Assigned To: mdejong
Priority: 8 Severity:
Status: Closed Last Modified: 2003-07-16 09:11:50
Resolution: Fixed Closed By: mdejong
    Closed on: 2003-07-16 02:11:50
Description:
On Solaris 8 / CDE, with 8.4b3 Tcl/Tk, and gcc 3.0.3:

Build Tcl:

    ./configure --enable-threads --disable-shared
    make

Build Tk:

    ./configure --with-tcl=... --disable-shared
    make

Try to run wish:

    ./wish
    Tcl_InitNotifier: unable to start notifier thread
    Abort
User Comments: mdejong added on 2003-07-16 09:11:50:
Logged In: YES 
user_id=90858

Well, I would rather just leave this patch in the CVS
and not change the 8.4 release if at all possible. Closing.

dgp added on 2003-07-03 01:04:45:
Logged In: YES 
user_id=80530

well, I'm recently bitten when it
comes to commits on the stable
branch, and the changes seem
significant, so I counsel caution.

That said, I'll defer to your
judgment as the build maintainer.

mdejong added on 2003-07-03 00:35:03:
Logged In: YES 
user_id=90858

So, should this patch be checked into the 8.4 branch now?

dgp added on 2003-04-05 02:51:40:
Logged In: YES 
user_id=80530

Agreed.  This is good for alpha testing
on the HEAD.  Needs a lot more testing
before eligible for the stable branch.

The hanging test in the test suite is
now reported as Bug 714956.

mdejong added on 2003-04-05 02:49:19:
Logged In: YES 
user_id=90858

I checked the patch into the CVS HEAD, but I think some further
testing is needed before checking this into the 8.4 branch. I am
leaving this bug report open until later. As far as the
runtime loading
issue goes, I think that should be entered as a separate bug.

dgp added on 2003-04-04 06:42:07:
Logged In: YES 
user_id=80530

that patch works great with all
my build systems.

IMO, it's ready to commit to
HEAD for more widespread
testing.

mdejong added on 2003-04-04 06:10:05:

File Added - 46742: threads.patch2

Logged In: YES 
user_id=90858

Here is my second attempt at a Tk threads fixup. This
patch removes a bunch of checks from the Tk configure
script and uses TCL_LIBS instead. It should fix the
dup lib problem you were running into.

dgp added on 2003-04-04 01:38:33:
Logged In: YES 
user_id=80530

When I try the same patch on my Linux/Alpha
box, the linking of wish fails because the
-lieee flags ends up on the link line twice.

This is because it is in WISH_LIBS twice.

This is apparently because it comes in 
as part of @LIBS@ and part of @MATH_LIBS@

dgp added on 2003-04-04 01:06:08:
Logged In: YES 
user_id=80530

Thanks, Mo.  With this patch, the problem
I reported with a panic in wish goes away.

Running `make test` is see test window-2.9
hang, but that's probably another bug, just
exposed by the lack of an early failure.

mdejong added on 2003-04-03 17:57:31:

File Added - 46689: threads.patch

mdejong added on 2003-04-03 17:57:30:
Logged In: YES 
user_id=90858

I poked around in the configure.in for Tk and it
does look like the TCL_LIBS var set in tclConfig.sh
is being ignored by Tk. One fix could be to just use
this variable when linking wish.

I don't see any calls to pthread functions anywhere in
Tk, so I don't see why we need to check for them
via a call to SC_ENABLE_THREADS in Tk's
configure.in. I am worried that _REENTRANT
will not get passed to the compiler if this call is
removed, so that may need to get fixed. There are
also some uses of TCL_THREADS in the Win
and Mac versions of Tk, but I think the unix one
is ok.

Here is a patch the implements the change I propose,
could someone give it a test run to see if things are
working? The configure script change as of todays
CVS is included.

dgp added on 2003-03-28 06:16:01:
Logged In: YES 
user_id=80530

note that the definition for TCL_LIBS
in the tclConfig.sh file correctly includes
the -lpthread flag, telling all programs
that plan to embed the Tcl library that
it should be included in the link.

Apparently, Tk's Makefile is not taking
note of this for its wish build.

dgp added on 2003-03-28 06:08:39:
Logged In: YES 
user_id=80530


the problem is that the -lpthread flag
is missing when wish is linked.

dgp added on 2003-03-28 06:02:37:
Logged In: YES 
user_id=80530

tracing a bit more, the calls to
pthread_create() return -1.

dgp added on 2003-03-27 06:37:56:
Logged In: YES 
user_id=80530


Same symptoms when using

$ cc -V
cc: Sun WorkShop 6 update 1 C 5.2 2000/09/11

as the compiler.

dgp added on 2003-03-27 06:22:25:
Logged In: YES 
user_id=80530

same observations on the HEAD (8.5a0)

dgp added on 2003-03-27 05:55:12:
Logged In: YES 
user_id=80530

claiming to attempt to
reproduce with latest
release.

dgp added on 2002-08-26 23:51:50:
Logged In: YES 
user_id=80530

OK, is this only a compile-time constraint,
or does it need to be enforce at runtime as well?

Say I avoid conflicts at build time, and I build
and install thread-disabled Tcl and Tk and
thread-enabled Tcl and Tk.

What happens when I try to [load] threaded-Tk
into nonthreaded-Tcl?  What happens when I
try to [load] nonthreaded-Tk into threaded-Tcl ?

If either of these combinations is invalid, then
the package index script for Tk needs to prevent
them, and that's more than just a TEA warning.

hobbs added on 2002-08-26 23:46:00:
Logged In: YES 
user_id=72656

IMO, the configuration setup was invalid, but was "allowed" 
technically.  The new TEA prints out a big warning when you 
configure incompatibly in this way, and the only fix that is 
needed is to make Tk whine the same way regarding --enable-
threads.

dgp added on 2002-08-26 21:58:52:
Logged In: YES 
user_id=80530

It appears that the requirement for --enable-threads
consistency with Tcl only arises because Tk includes
the tclInt.h header file.  An alternative fix then woulld
be to remove that #include.

dgp added on 2002-08-21 00:32:32:
Logged In: YES 
user_id=80530


If I configure Tk with --enable-threads as well,
this problem goes away.

So, if Tk and Tcl need to have the same --enable-threads
choice to work, then they should not be separately configurable.
Tk should just take whatever choice was made by the Tcl it is
configured against.

Also, since Tk is now dynamically [load]able, there may need to
be checks added to Tk's pkgIndex.tcl file to be sure that a
thread-enabled Tk library [load]s only in a thread-enabled Tcl
interp, and vice versa.

Would be a lot nicer if these two modules could be configured
separately and still work, though.

Attachments: