Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 '10 at 7:52

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.