socket writes hanging if endpoint can't be reached
Closed / Fixed218324ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:56:10
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
welch Closed ticket [218324ffff].
[History diff]2000-10-26 08:19:01
dgp Ticket [218324ffff]: 3 changes
[History diff]2001-04-01 01:48:01
Log in (anonymous is fine) to add a comment.