Tcl Source Code

View Ticket
Login
Ticket UUID: 3494470
Title: called Tcl_FindHashEntry on deleted table
Type: Bug Version: obsolete: 8.5.10
Submitter: rtreleaven Created on: 2012-02-26 01:18:12
Subsystem: 80. Thread Package Assigned To: vasiljevic
Priority: 3 Low Severity: Minor
Status: Closed Last Modified: 2013-11-12 12:34:08
Resolution: Invalid Closed By: dkf
    Closed on: 2013-11-12 12:34:08
Description:
% puts $tcl_patchLevel
8.5.10
% parray tcl_platform
tcl_platform(byteOrder)   = littleEndian
tcl_platform(machine)     = x86_64
tcl_platform(os)          = Linux
tcl_platform(osVersion)   = 3.0.0-16-generic
tcl_platform(platform)    = unix
tcl_platform(pointerSize) = 8
tcl_platform(threaded)    = 1
tcl_platform(user)        = rtreleaven
tcl_platform(wordSize)    = 8
% 

Problem Behavior
The script below produces this output >90% but  <100% of the time.

$ tclsh getHelp.tcl
Does thread exist? no
Does thread exist? no
Does thread exist? no
Does thread exist? no
Does thread exist? no
Does thread exist? no
called Tcl_FindHashEntry on deleted table
$ echo $?
0

Expected Behaviour
The message "called Tcl_FindHashEntry on deleted table" should not be generated

Concise Code Sample

set truth(1) yes
set truth(0) no
package require Thread
set id [ thread::id ]
for { set i 0 } { $i < 6 } { incr i } {
thread::create -preserved {
while 1 {
for { set i 0 } { $i < 9999999 } { incr i } {}
update
}
}
}
after 1000
foreach id [ thread::names ] {
if { $id eq [ thread::id ] } { continue }
thread::release -wait $id
puts "Does thread exist? $truth([ thread::exists $id])"
}
User Comments: sebres added on 2012-02-28 20:04:37:
The infinite loop was blame - ("while 1")
Try following script to prevent an endless running:

package require Thread
set id [ thread::id ]
set tid [
thread::create {
while {![info exists ::thstop]} {
for { set i 0 } { $i < 9999999 } { incr i } {}
update
}
puts end!!!!
}
]
after 1000
thread::send -async $tid {set ::thstop 1}
catch {thread::release -wait $tid}

sebres added on 2012-02-28 18:29:29:
still strange:

windows x32 / debian x64,
tcl 8.5.11 with thread 2.6.7
core-8-5-brunch with thread 2.7

first script runs without any problem, BUT
second script runs to his end, hereafter something runs infinity in background  with cpu load 50%. "thread::names" returns main thread only.

rtreleaven added on 2012-02-26 09:27:44:

File Added - 436720: getHelp.tcl

rtreleaven added on 2012-02-26 08:21:28:

File Added - 436717: getHelp.tcl

rtreleaven added on 2012-02-26 08:21:03:
added the actual script

Attachments: