Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-01-23
23:14 • Closed ticket [3295154fff]: Sockets not responding plus 7 other changes artifact: 64e2bcce3c user: nijtmans
17:55 • Ticket [3295154fff]: 4 changes artifact: 163f2a221e user: twylite
17:32 • Pending ticket [3295154fff]. artifact: 7c9388dd15 user: nijtmans
2011-04-30
05:46 • Ticket [3295154fff]: 4 changes artifact: 6bb534012c user: mb-austin
05:34 • Ticket [3295154fff]: 4 changes artifact: f15bbb3d06 user: mb-austin
05:34 • Add attachment sockettest.tcl to ticket [3295154fff] artifact: 39ee70db18 user: mb-austin
2011-04-29
22:34 • New ticket [3295154fff] Sockets not responding. artifact: 99b0dce3ae user: mb-austin

Sockets not responding

Closed / Duplicate3295154fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 14 years ago
Descriptionplain2011-04-29 22:34:42
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
mb-austinplain2011-04-30 05:34:42
File Added - 410269: sockettest.tcl
mb-austinplain2011-04-30 05:46:00
A little more searching shows that it is very similar (if not identical) to
 bug 3056775.

That bug was reported as fixed.
nijtmansplain2013-01-23 17:32:16
I cannot reproduce this (On Windows 7, win32),
just always getting all 10 expected connections.

Regards,
        Jan Nijtmans
twyliteplain2013-01-23 17:55:42
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.
nijtmansplain2013-01-23 23:14:06
Dup of 3056775, closing.
Log in (anonymous is fine) to add a comment.

Attachments: