0

I noticed following behavior on two of my CENTOS7 machines .. (it also happened on a RHEL6 too).

Sometimes meanwhile i'm typing, my session freezes. What I've already figured out.

  • Router shows connections as still active but as idle
  • ping has recorded no errors while transmitting packets (server got pinged the whole login)
  • I can immediately login to a second session, check the log and see following:
systemd-logind: New session 1 of user root.
systemd: Started Session 1 of user root.
systemd: Starting Session 1 of user root.
systemd-logind: New session 2 of user root.
systemd: Started Session 2 of user root.
systemd: Starting Session 2 of user root.

So the session, seems to be opened anyway. As soon as I close the freezed window systemd-logind: Removed session 1. appears.

There is no error "Write failed: Broken pipe", which appears after a disconnect.

I connect via BASH from my ubuntu desktop. It never happended to another Server. Just them. SSH is configured with default settings.

The machine is setted up new, it is a cluster and it appers on both nodes. Well actually the cluster isn't configured, they are just two server, setted up completey the same.

EDIT: I also noticed, that the freezed session is shown as active on the router, but idle since freeze, even with the session window closed ..

5
  • Are you sure you are not just suspending the current session flow with ctrl+s? If that happens, ctrl+q resumes the session. Nov 14, 2016 at 11:26
  • yep, completely sure. I've checked that almost Nov 14, 2016 at 11:55
  • 1
    That just sounds like packet loss and tcp retransmits messing with you. Here is a small function that uses watch and netstat -s to keep an eye on counters that may prove usefull here. Just source that function and type watch_net, ideally in a screen session.
    – Aaron
    Nov 14, 2016 at 15:17
  • Hey @Aaron, this is very useful. Thanks a lot for this. But somehow, it only appears in the first 5minutes after reboot. But i will do this. But if a TCP packages get lost, my ping should also be lost - or am I wrong ? Nov 15, 2016 at 7:48
  • It would be difficult to speculate or generalize. It's best to just get numbers from netstat (on both sides if you can) and see who thinks they are having to restransmit and who thinks they are losing packets, etc. FWIW you may be able to work around this better by setting net.ipv4.tcp_thin_linear_timeouts=1 and net.ipv4.tcp_thin_dupack = 1 in /etc/sysctl.conf and run sysctl -e -p after you research what that does and if your kernel supports it.
    – Aaron
    Nov 15, 2016 at 16:00

1 Answer 1

0

The configuration for this is in the file ~/.ssh/config. To send the signal every four minutes to remotehost, put the following in your ~/.ssh/config.

Host remotehost
  HostName remotehost.com
  ServerAliveInterval 240

This is what I have in my ~/.ssh/config.

To enable it for all hosts use:

Host * ServerAliveInterval 240

Also make sure to run chmod 600 ~/.ssh/config, because the config file must not be world-readable.

1
  • This would presume, that my remote server cancel the connection because it hasn't rescieved a signal for a while .. but I can execute several commands in a row with seconds between them and than, it freezes while typing the next one randomly. Nov 14, 2016 at 11:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .