Question

This is been making my programming really frustrating lately.

I´m in Argentina right now connecting to a U.S. server via SSH. Understandably, the pings are a bit higher here (around 200ms on average) so when I SSH into the server there is a slightly noticeable lag between each keystroke. This is fine and easy enough to work with.

What isn´t easy to work with is that about every 5 minutes or so, SSH will completely hang and take about 3-5 minutes to return back a prompt. I know the server is not bogged down because I can easily open several new connections while I´m waiting for one to return (in fact this is the only way I´ve been able to work). And when SSH finally comes back I can see it has actually been working away in the background (large file downloads was a good way to test this) but it just hasn´t been updating my screen.

Does anyone have an idea what might be causing this?

Few other facts: the server is Ubuntu and I'm connecting with Mac OS X. I have keepalive turned on in the SSH settings. It is most likely to hang when I hold down a key (for example a left or right arrow to scroll) which sends a lot of keys quickly. In fact I can reliably reproduce the hang by logging in and holding down any key like "a" - it never makes it past a full line of "a"'s before hanging. This just started when I connected internationally for the first time so I´m assuming it has something to do with that (latency?) but can´t say for sure.

Was it helpful?

Solution 2

I think it was some problem with the ISP down here in argentina. When I switched to another wireless network with another ISP it started working. They are probably playing some port throttling games or who knows what.

OTHER TIPS

Odd. I can't help you with your problem but I have a tip to make it less annoying: Use screen(1). This will keep your shell on the other end alive and you can continue whatever you were doing after reconnecting.

If you only need to run a command on the other side, I suggest to pass the command as an option to ssh (it will connect, run the command, display the result and disconnect).

Try adjusting your TCP window size.

I'm used to ssh over high latency links - 600ms. It is slow but I rarely had any problems. To start with - open another terminal window, ping your server and watch the connection. Tell us what you see.

Try sshing in with a few verbose flags (ssh -vv[vv] somehost) and seeing if there's anything indicative printed around the time it hangs.

Well, I am now connected to a different wireless network and the problem seems to have disappeared. I can't say for sure what exactly was causing it (and I don't have login access to the wireless router) but this seems to suggest it was something on the router, and not the server or client computer.

Both the old router and the new router were Linksys WRT54G's so I'm not sure what the problem was. Hope it helps someone!

I was having a similar problem with 'cat' and even 'ls -l' causing ssh to hang (on Ubuntu). Adjusting MTU size to 1400 fixed it for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top