Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6086f9392e0c919aa46f37eb1cbba35b22629e19
Ticket: 219307ffffffffffffffffffffffffffffffffff
Tcl's fileevent callback on a socket does not work the same
User & Date: nobody on 2000-10-26 05:10:27
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 3319 Bug
    Version: 8.2.1
    SubmitDate: '1999-11-05'
    LastModified: '1999-11-11'
    Severity: MED
    Status: UnAssn
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Linux-Red Hat
    OSVersion: RedHat 5.2 (intel)
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Name:
    Mo DeJong
    
    ReproducibleScript:
    # First, start the "server" and listen for connections.
    # When a connection arrives just close the socket.
    
    set port 6789
    
    proc incomingConnection { stream addr port } {
        puts "incomingConnection from $addr $port"
        close $stream
    }
    
    set server [socket -server incomingConnection $port]
    
    # Now create the "client" socket which makes a connection
    # This causes the error {error writing "sock7": broken pipe}
    
    proc canWrite { } {
      global socket
      if {[eof $socket]} {
        puts "EOF ON SOCKET"
      }
    
      puts "Writing to socket"
      puts $socket "CLOSE"
    }
    
    set socket [socket localhost $port]
    fconfigure $socket -buffering line -blocking 0
    fileevent $socket writable canWrite
    
    vwait forever
    
    ObservedBehavior:
    This generates an error on UNIX systems when the socket is closed on the
    server side. The client tries to write when it gets a fileevent writable
    event, and this generates and during the write() call because the socket
    was closed.
    
    
    It does not work on these systems:
    RedHat Linux 5.2 with Tcl 8.2.1
    Solaris 5.6 with Tcl 8.2.1
    IRIX 6.2 with Tcl 8.2.1
    
    But under NT with Tcl 8.2.1, the extra fileevent
    callback is not generated.
    
    DesiredBehavior:
    A fileevent writable callback should not be generated on a closed socket
    under UNIX systems.
    
    
    
    Newsgroup reports indicate that NT has the incorrect behavior. 
    -- 11/11/1999 hobbs
    
  4. foundin changed to: "obsolete: 8.2.1"
  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: "63. (unused)"
  10. title changed to:
    Tcl's fileevent callback on a socket does not work the same 
    
  11. type changed to: "Bug"