Ssh – Putty Terminal Locks randomly

puttysshterminal

I have an issue where my Putty Session will become unresponsive after a period of time. If I am tailing something, or waiting on a process that does not return data while executing, the terminal will lock freeze, even if data then gets returned. Pressing keys will result in a substantial delay until the display suddenly updates and shows the output that was happening in the background.

This is not a CTRL+S issue, this happens without the terminal in focus, and seemingly randomly.

My current workaround is having a clock shell script outputting the time in a corner of the terminal, but this merely allows me to glance and tell if the window is locked, and how long it has been locked. This doesn't work as it moves the cursor, and causes headaches when a lot of data is outputting, or when trying to type.

Is this a server configuration? Or something I should look into with the Putty Client? This only happens on one server that I can tell, so I am not sure. Are there solutions?

Best Answer

Normally keepalive packets will be sent between the client and the server. If your server is someplace like Amazon, you'll experience what they call stateless connections. What this means is that the TCP keepalives don't tend to work too well.

In putty you can do the following:

In your session properties, go to Connection and under Sending of null packets to keep session active, set Seconds between keepalives (0 to turn off) to e.g. 300 (5 minutes).

On my Linux clients I put the following in my /etc/ssh/ssh_config file:

ServerAliveInterval 300

ServerAliveCountMax 2

Basically this causes your client to send a null packet to the other end and keep the connection from closing down from the server end.