OS - Windows Vista
Tcl Version - Activestate 8.6b1.2
creating multiple client sockets over a short period of time cause the server socket to quit responding. Incoming connections are accepted, but the command for the server socket server is never called.
I've include a single file that causes the problem on my machine. it builds a socket server that just listens for connections and logs when one comes in.
It also creates 10 client requests.
Only some fraction of these client requests are logged.
I was worried that it might be caused from the client/server running from the same program, so I split up and ran with client on one machine and server on another. The same problem still happened.
---- server.tcl -----
set connection_count 0
proc connect {args} {
incr ::connection_count
puts stdout "$::connection_count -- connect from $args"
}
socket -server connect 4444
puts stdout "waiting for connection"
vwait forever
------- end of server.tcl ------------
----- client.tcl -------------
proc doit {{count 10}} {
for {set x 1} {$x <= $count} {incr x} {
puts stdout "$x -- start connection "
socket localhost 4444
#after 1
}
}
doit
-------- end of client.tcl ------
Expected Output:
I would expect for the server to show 10 connections.
the actual result is some number < 10.. by tweaking the after value in the client you can slow it down enough to get all 10 requests.
I thought this might be a problem with too many sockets in a TIMED_WAIT state, but I waited until I had no sockets in the timed wait state, ran the test and got this result
$ tcl sockettest.tcl
1 -- start CLIENT
1 -- SERVER -- connect from sock420 127.0.0.1 61692
2 -- start CLIENT
2 -- SERVER -- connect from sock428 127.0.0.1 61693
3 -- start CLIENT
3 -- SERVER -- connect from sock440 127.0.0.1 61694
4 -- start CLIENT
5 -- start CLIENT
4 -- SERVER -- connect from sock460 127.0.0.1 61695
6 -- start CLIENT
7 -- start CLIENT
8 -- start CLIENT
9 -- start CLIENT
10 -- start CLIENT
total connections: 4
client_server program to rapidly start 10 clients against a server.
A little more searching shows that it is very similar (if not identical) to
bug 3056775.
That bug was reported as fixed.
I cannot reproduce this (On Windows 7, win32),
just always getting all 10 expected connections.
Regards,
Jan Nijtmans
I strongly suspect this is bug 3056775 "Socket -server stops accepting connections under load", which has been fixed. See https://sourceforge.net/tracker/?func=detail&aid=3056775&group_id=10894&atid=110894.
I can reproduce this bug on $tcl_patchLevel = 8.6b1.2 (which is what 3056775 was reported against), but have no problems on 8.6.0 release (built from Fossil tag, using MSVC10).
... and now I see mb-austin's comment to the same effect ;) Recommend you try with the latest ActiveState release.
Dup of 3056775, closing.