Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 00368836b074e1e3fd733a8516f91b6b9a061b14
Ticket: 218003ffffffffffffffffffffffffffffffffff
"readable" fileevents behave inaccurately on Windows
User & Date: nobody on 2000-10-26 00:51:52
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 700 Bug
    Version: 8.0.3
    SubmitDate: '1998-10-09'
    LastModified: '1999-08-09'
    Severity: MED
    Status: Closed
    Submitter: suresh
    ChangedBy: redman
    OS: All
    OSVersion: NA
    Machine: NA
    FixedDate: '2000-10-25'
    FixedInVersion: 8.2b2
    ClosedDate: '1999-08-09'
    
    
    Basically there appears to be a bug in the handling of events via the "fileevent" command on Windows.  The bug is that on Windows, fileevents come in at unpredictable times and inconsistent with the same script that runs on UNIX.   See the script below and the produced output on both Windows and UNIX.
    
    See the following script
    
    =======================================
    # fileevent-bug.tcl
    set hosts {pop hippo cerridwen}
    proc myProc {f host hostDone} {
        if {![eof $f]} {
    puts "0 [clock sec] $host $f -- readable"
    read $f
        } else {
    puts "1 [clock sec] $host $f -- eof"
    set ::$hostDone $host
        }
    }
    set sleepTime 0
    foreach host $hosts {
        set hostFiles($host) [open "| rsh $host sleep [incr sleepTime 10]"]
        puts "$host $hostFiles($host)"
    }
    set allHostsDone 0
    foreach host [array name hostFiles] {
        fileevent $hostFiles($host) readable  [list myProc $hostFiles($host) $host hostDone]
    }
    while {[array size hostFiles]} {
        vwait hostDone
        puts "2 [clock sec] $hostDone $hostFiles($hostDone) -- hostdone"
        catch {close $hostFiles($hostDone)} result
        unset hostFiles($hostDone)
    }
    =======================================
    
    If you run this script on Windows, you will get the following output:
    
    =======================================
    [c:\temp]tclsh80 z:\fileevent-bug.tcl
    pop file160
    hippo file76
    cerridwen file24
    0 907963252 pop file160 -- readable
    0 907963262 cerridwen file24 -- readable
    0 907963284 hippo file76 -- readable
    1 907963284 pop file160 -- eof
    2 907963284 pop file160 -- hostdone
    1 907963284 cerridwen file24 -- eof
    2 907963284 cerridwen file24 -- hostdone
    1 907963284 hippo file76 -- eof
    2 907963284 hippo file76 -- hostdone
    =======================================
    
    However, on UNIX you get:
    
    =======================================
    pop> tcls8.0h fileevent-bug.tcl 
    pop file3
    hippo file5
    cerridwen file8
    0 907963245 pop file3 -- readable
    1 907963245 pop file3 -- eof
    2 907963245 pop file3 -- hostdone
    0 907963255 hippo file5 -- readable
    1 907963255 hippo file5 -- eof
    2 907963255 hippo file5 -- hostdone
    0 907963266 cerridwen file8 -- readable
    1 907963266 cerridwen file8 -- eof
    2 907963266 cerridwen file8 -- hostdone
    =======================================
    
    
    
    This bug was discovered during development of TclPro nightly build script.  The script kicks off UNIX hosts in parallel from Windows via the Windows RSH.EXE command;  if you look at the build output e-mail, you see that all the UNIX builds finish exactly at the same time (to the second), which is unlikely and is due to "fileevent" waiting for all hosts to "remove" themselves from the "fileevent" list.  (suresh:981009)
    
    
    
  4. foundin changed to: "obsolete: 8.0.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "62. (unused)"
  10. title changed to:
    "readable" fileevents behave inaccurately on Windows
    
  11. type changed to: "Bug"