Since the client processes are still alive, then the TCP stack in the kernel will process the keep-alive packets it receives with an acknowledgement packet back to the sender of the packet. So, even though the connection is indeed idle, the connection will never be closed since the kernel is happily processing the packets.
On a real network, given your parameters, the connection would be closed if the ACK from the client machine ever got lost. On your setup, since the client and server are on the same machine, your network will be essentially lossless.
It is unclear to me how you got your telnet
sessions in this state. SIGTERM
will not put a process in the stopped state. The process goes into stopped state when receiving SIGSTOP
(and usually SIGTSTP
, but it seems telnet
ignores that one). I suggest that perhaps you sent that signal by mistake, or you suspended the session (with ^]z
). When that happened, you should have seen in the window, the one with your telnet session, generate output like:
[1]+ Stopped telnet ...
This is printed by the shell. When the telnet
process is stopped, it won't process the SIGTERM
until after it is placed in the foreground.
A SIGKILL
(done with kill -9 <pid>
) will be processed immediately.