Sometimes after loading up the system
with a lot of job processing (open, close socket and returning
reply to client sockets), we found tclsh to
be in some heavy spin loop where
it is polling (calling pollsys)
all the time. cpu usage jumps from 10% to 45%.
A lot of memset and memcpy calls are also bing made.
Has anyone seen this kind of spin loop ?
More detailed analysis with gdb shows that
TcpOutputProc is repeated being called
to write out data to a socket that may not exist
resulting in errno of EWOULDBLOCK.
And somehow tcl keeps trying to output the data.
If we use the "socket $host $port"
option instead of "socket -async $host $port"
the problem is not seen.