Tcl Source Code

View Ticket
Login
Ticket UUID: 2018603
Title: thread.test hangs, thread-7.4 fails
Type: Bug Created on: 2008-07-15 12:14:20
Submitter: dkf Assigned to: dkf
Subsystem: 49. Threading Severity:
Priority: 9 Immediate Last modified: 2008-07-15 20:50:50
Status: Closed Closed by: dkf
Resolution: Fixed Closed on: 2008-07-15 13:50:50
Version: obsolete: 8.6a1
Description:
In a threaded build on OSX, thread.test hangs in thread-7.5 after a failure in thread-7.4. Failure info is as follows:

==== thread-7.4 cancel: pure bytecode loop FAILED
==== Contents of test case:

    threadReap
    unset -nocomplain ::threadError ::threadId ::threadIdStarted
    set serverthread [testthread create -joinable {
proc foobar {} {
    if {![info exists foo]} then {
# signal the primary thread that we are ready
# to be canceled now (we are running).
testthread send [testthread id -main]  [list set ::threadIdStarted [testthread id]]
set foo 1
    }
    while {1} {
# No bytecode at all here...
    }
}
foobar
    }]
    # wait for other thread to signal "ready to cancel"
    vwait ::threadIdStarted; after 1000
    set res [testthread cancel $serverthread]
    testthread join $serverthread
    while {[testthread event]} {}; # force events to service
    threadReap
    list $res [expr {[info exists ::threadIdStarted] ?  $::threadIdStarted == $serverthread : 0}]  [expr {[info exists ::threadId] ?  $::threadId == $serverthread : 0}]  [expr {[info exists ::threadError] ?  [lindex [split $::threadError \n] 0] : "" }]

---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: 
    while executing
"testthread cancel $serverthread"
    ("uplevel" body line 20)
    invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== thread-7.4 FAILED
User Comments:
das added on 2008-07-15 20:07:27:
Logged In: YES 
user_id=90580
Originator: NO

this failure is new, I verified that the original 2008-07-13 NRE commit passed the testsuite (except for the known failing tests (Bug 2017146)

das added on 2008-07-15 20:37:29:
Logged In: YES 
user_id=90580
Originator: NO

the following fixes the problem for me,  looks like you broke this yourself with your "tidying up" Donal!
maybe some more care is indicated before applying that kind of sweeping changes all over...

Index: generic/tclBasic.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
retrieving revision 1.311
diff -u -p -r1.311 tclBasic.c
--- generic/tclBasic.c14 Jul 2008 14:15:10 -00001.311
+++ generic/tclBasic.c15 Jul 2008 13:31:08 -0000
@@ -3843,7 +3843,7 @@ Tcl_CancelEval(
 
 goto done;
     }
-    if (interp != NULL) {
+    if (interp == NULL) {
 /*
  * A valid interp must be supplied.
  */