Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 24c0ff6d40520a16267738aa0d3b06e74ca9b0fb
Ticket: 218324ffffffffffffffffffffffffffffffffff
socket writes hanging if endpoint can't be reached
User & Date: nobody on 2000-10-26 00:56:10
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 3841 Bug
    Version: 8.2.2
    SubmitDate: '1999-12-10'
    LastModified: '2000-04-19'
    Severity: SER
    Status: Closed
    Submitter: techsupp
    ChangedBy: hobbs
    OS: Solaris
    OSVersion: Solaris 2.7
    Machine: UE2 UE450
    FixedDate: '2000-10-25'
    ClosedDate: '2000-04-19'
    
    
    Name:
    Christian Williams
    
    Comments:
    we use a Tcl-based chat server on our web site; every time a client becomes
    unreachable (i.e., its computer crashes, goes offline, etc), the whole server
    freezes up for as much as 60 seconds, while Unix decides that the connection
    is dead and returns an error on the send().  obviously this isn't a great user
    experience, and is our #1 complaint from our users.
    
    apart from this problem, Tcl works great as a server of this sort.
    
    ReproducibleScript:
    run this script from one host:
    --------------------------------------------
    proc run { sock args } {
      puts "Got connection... hit return to write"
      gets stdin
      set x 0
      while {$x < 10000} {
        puts -nonewline "\r$x bytes"; flush stdout
        puts -nonewline $sock "."; flush $sock
        incr x
      }
      puts ""; exit
    }
    
    socket -server run 6666
    vwait forever
    --------------------------------------------
    
    on another host, connect to that port:
       telnet hosta 6666
    
    now unplug the network connection of the second host, and hit
    return on the first.  the script will output data until it fills Unix's
    send buffer, then block in the puts.  this behaviour is the same
    no matter what the socket's fconfigure options are.
    
    ObservedBehavior:
    .....
    send(4, " .", 1, 0)                             = 1
    write(1, "\r 8 1 9 2   b y t e s", 11)          = 11
    send(4, " .", 1, 0)                             = 1
    write(1, "\r 8 1 9 3   b y t e s", 11)          = 11
    send(4, " .", 1, 0)             (sleeping...)
    
    DesiredBehavior:
    the fblocked command should indicate whether a puts will actually block,
    or there should be a configurable buffer size for writes,
    or Tcl should return an error,
    or ANYTHING but blocking!     ; )
    
    
    
    The user mentions fblocked, but I don't see it used.  In fact,
    it looks like this might all be cleared up if the user were
    to use non-blocking sockets throughout and base it all on
    fileevents.  Unless that case also hangs (which isn't specified). 
    -- 04/19/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.2.2"
  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: "socket writes hanging if endpoint can't be reached"
  11. type changed to: "Bug"