#5007 called Tcl_FindHashEntry on deleted table

obsolete: 8.5.10
pending-invalid
3
2012-02-28
2012-02-26
No

% 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])"
}

Discussion

  • Russell Treleaven

    added the actual script

     
  • Russell Treleaven

    second version

     
  • Serg G. Brester

    Serg G. Brester - 2012-02-28

    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.

     
  • Serg G. Brester

    Serg G. Brester - 2012-02-28
    • priority: 5 --> 3
    • status: open --> open-invalid
     
  • Serg G. Brester

    Serg G. Brester - 2012-02-28

    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}

     
  • Serg G. Brester

    Serg G. Brester - 2012-02-28
    • status: open-invalid --> pending-invalid