1

I'm logged in to my development box via SSH (using PuTTY on my laptop) and periodically, the session would just hang for a couple of seconds then becomes responsive again. I have not been able to narrow it down.

Network setup: server and laptop are connected to the same router.

Services on the box:

  • apache
  • CUPS
  • fail2ban
  • mysqld
  • samba
  • sendmail (for SMTP with dkim-filter)
  • SSH (as said before)

top output:

This is from a couple of minutes after the hangup happened.

top - 02:16:14 up 15 days,  1:11,  1 user,  load average: 0.00, 0.03, 0.07
Tasks: 125 total,   1 running, 124 sleeping,   0 stopped,   0 zombie
Cpu(s):  3.3%us,  1.5%sy,  0.0%ni, 92.5%id,  2.6%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   1017408k total,   950744k used,    66664k free,   359728k buffers
Swap:  4194300k total,    14012k used,  4180288k free,   191344k cached

Tips on figuring this out?

1
  • 3
    First, I'd try to determine if you're experiencing a network issue which simply stops SSH input/output - or a problem on your server which causes sshd and other processes to hang briefly. Install a monitoring tool, one fine-grained enough to show you if network/cpu stops for a few seconds. If you have two SSH sessions open, do they both hang at the same time? Does sshd respond with the SSH protocol header if you connect to port 22? Can you access the box via other network services during this time?
    – Alex Holst
    Dec 6, 2010 at 7:52

1 Answer 1

2

My guess:

SSHv2 clients initiate a key re-exchange after every X minutes and/or Y bytes transferred (in case of PuTTY, the defaults are 60 mins and 1 GB). The rekey should only take 1-3 seconds, but until it finishes no other data can be transferred through the SSH connection.

Look for "Initiating key re-exchange (reason)" in PuTTY's Event Log. (Ctrl Right Click on the terminal window.)

Event Log

If this is indeed the reason, you can:

  • move a specific algorithm (such as DH group 14) above "group exchange" in Connection → SSH → Kex
  • increase the re-exchange timeout in the same page
1
  • A recent PuTTY update (0.65) fixes a revision in the Diffie-Hellman group exchange - if you use any of the PuTTY forks it might not be recently updated - hence it hangs. As a workaround you can goto SSH -> Kex and put "group 14" above "group exchange".
    – dza
    Sep 5, 2015 at 22:25

You must log in to answer this question.

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