Tcl Source Code

View Ticket
Login
Ticket UUID: 651139
Title: logic error in tclThread.c
Type: Bug Version: obsolete: 8.4.1
Submitter: nobody Created on: 2002-12-09 22:27:55
Subsystem: 49. Threading Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-12-10 11:16:06
Resolution: Fixed Closed By: hobbs
    Closed on: 2002-12-10 04:16:05
Description:
While trying to get setup to duplicate that other 
bug (#649209), I discovered a severe logic error in 
the TclFinalizeThreadData function.  This bug is 
somewhat specific to Windows and definitely 
specific to non-threaded builds.  This is the kind 
of bug that could potentially be responsible for 
more than one open bug.

TclpMasterLock is called unconditionally on 
tclThread.c:409, however the accompanying 
TclpMasterUnlock is only called if TCL_THREADS is 
defined.  Of course, this is totally fatal to the 
process, because once the critical section has been 
acquired by one thread, it is forever orphaned and 
according to the Win32 API docs, the results of a 
thread dying while holding a critical section 
are "undefined".  Additionally, TclpMasterUnlock is 
not defined when TCL_THREADS is not defined.  It 
should always be declared, regardless of the 
TCL_THREADS define.  

Fortunately, a cursory search of the Tcl source code 
turned up no other instances of this particular logic 
error.

I can create a patch for this bug if you want, but it 
would involve some work, since my local Tcl 
source is not quite in sync with CVS.

JJM
User Comments: hobbs added on 2002-12-10 11:16:06:

File Added - 37243: tclmasterunlock-651139.diff

hobbs added on 2002-12-10 11:16:05:
Logged In: YES 
user_id=72656

patch against 8.3.5 for reference attached.  patch commited 
for 8.3.5+ / 8.4.1+.

hobbs added on 2002-12-10 07:32:21:
Logged In: YES 
user_id=72656

This required also that TclpMasterUnlock was not conditional 
to TCL_THREADS in tclWinThrd.c.

andreas_kupries added on 2002-12-10 05:31:08:
Logged In: YES 
user_id=75003

Also for David G. possibly.

Attachments: